Hi ,
I have a table that has customer,product,month ,year and month ,information . Now if the user passes the following value for the month period .
Current Cycle --- Current Month ,Previous Month and the difference between the two
If @ period = 'Current Cycle'
Begin
--- Power Pivot Query
Output like :
Customer | May-14 | Jun-14 | May 14 - JUNE 14 |
Ron | 150 | 0 | 150 |
Dash | |||
Viper | 150 | 0 | |
Tom | 450 | 0 | 450 |
Dash | |||
Belt | 450 | 150 |
End
If @period = 'Current Quarter '
Begin
Power Pivot Query
End
Output Like
Customer | Apr-14 | May-14 | Jun-14 | April14 - May14 | May 14 - JUNE 14 |
Ron | 300 | 150 | 0 | 250 | 150 |
Dash | 300 | 0 | 0 | 0 | 0 |
Viper | 0 | 150 | 0 | 0 | 0 |
Tom | 150 | 450 | 0 | -300 | 450 |
Dash | 150 | 0 | 0 | ||
Belt | 0 | 450 | 150 |