Forum Discussion

Oros's avatar
Oros
Icon for Post Prodigy rankPost Prodigy
4 years ago

Monthly comparison over years

Hello.

 

I have a month comparison (last year LY and current year CY).  I have a data starting NOV 2021.  How do you make the month comparison start in NOV 2021 instead of JAN 2022.  How do you compare (monthly, year over another year) based on last X months?  Thanks.

 The measures applied for LAST YEAR'S and CURRENT YEAR

 

There is also a separate DATE TABLE created using a query:

 



 

8 Replies

  • abusen333's avatar
    abusen333
    Frequent Visitor

    OK So the idea is adding new colums to your calendar table and slice by them , same as fiscal year . 

    note ;

    please dont forget to change the current column to the new colum in your dax measre .

     

      • abusen333's avatar
        abusen333
        Frequent Visitor

        IT will be easy for to provide example of you problem in power BI format.

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Oros ,

     

    Please try the measure.

     

    Rolling x months = 
    VAR x = 3
    RETURN
        CALCULATE (
            SUM ( 'SALES TABLE'[Sales] ),
            DATESINPERIOD ( 'DATE TABLE'[Date], MAX ( 'DATE TABLE'[Date] ), -1 * x, MONTH )
        )

     

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Oros's avatar
      Oros
      Icon for Post Prodigy rankPost Prodigy

      Hello v-kkf-msft ,

       

      Thank you for your reply.  How and where do you insert the ROLLING X MEASURE in this matrix table?

       

       

      • v-kkf-msft's avatar
        v-kkf-msft
        Icon for Community Support rankCommunity Support

        Hi Oros ,

         

        I simply add the measure and Sales to the Values field of the matrix, and I switch the value to rows in the attribute for easier comparison.

         


        If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
        Best Regards,
        Winniz
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.