Forum Discussion

Catherine84's avatar
Catherine84
Helper I
7 years ago
Solved

Rolling data for 4 quarters

Hi,   Hoping the experts can help me with the dax below.   I have a set of data with quarter but no dates. I need to get a rolling 4 quarters ( 12 months) data for Sales and COGS. Ie for Q1 2017...
  • Ashish_Mathur's avatar
    7 years ago

    Hi,

     

    You may download my PBI file from here.

     

    Hope this helps.

     

  • Ashish_Mathur's avatar
    Ashish_Mathur
    7 years ago

    Hi,

     

    Remove Account code from the column labels.  Try this measure

     

    Rolling 4 quarter sales value = CALCULATE([Sales QTD amount],DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-9),MAX('Calendar'[Date])))

     

    Rolling 4 quarter COGS value = CALCULATE([COGS QTD amount],DATESBETWEEN('Calendar'[Date],EDATE(MIN('Calendar'[Date]),-9),MAX('Calendar'[Date])))

  • Ashish_Mathur's avatar
    Ashish_Mathur
    7 years ago

    Hi,

     

    In the filter section (right hand side pane), click on Year and select Do not Summarize.

  • Ashish_Mathur's avatar
    Ashish_Mathur
    7 years ago

    Hi,

     

    There is no mistake in my formula.  I think there is a problem in the Date column of your Data Table.  The 4th quarter of 2016 should be March - May of 2017, so the date should be 1 March 2017 (not 1 March 2016 - as is appearing in your PBI file).  Please check.

     

    That is all i can help with.