Forum Discussion

sbm's avatar
sbm
Icon for Helper II rankHelper II
6 years ago

Need Help to show values dynamically in column header in matrix

Hi Experts,

 

I have a below a report based on a direct query storage mode with year and month filter. I want to create it dynamic to show column header. if I select Jan month in filter, column header show the last 2-month for Nov and Dec including Jan to see the trends and when I select Feb, column header should show with Nov and Dec and so on 

Below is the example screenshots. I have selected manually Jan, Nov and Dec in screenshot.

 

 

 

 

Expected output

5 Replies

  • I am assuming you have a calendar table. Try

    Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH))
    Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,MONTH))  
    

     

    • sbm's avatar
      sbm
      Icon for Helper II rankHelper II

      Hi amitchandak , 

      Yes, I have a date table. The following formula returns the sales for the 3 months prior to the selected date. but I have not a requirement of previous 3-month sales. I have a measure of total sales. for now, I am selecting manually for Jan, Nov and Dec month to show total sales but  I want to show dynamically if I select any single month from month filter, for example, Jan month then total sales should show also for  Nov and Dec month with Jan as well in matrix visual. if I select Feb month then total sales should show Feb , Nov and Dec like this.