Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Week over Week change %

Hello,

 

I need to calculate Week over Week change %. 

 

i write the following DAX but red highlighted one has Error.

 

How should  i change the expression?

 

 

Week change =
VAR lastweekamount =
CALCULATE(
SUM(Power_BI_Book_Coin[R_Coin_Cnt]),
FILTER(
ALL(Power_BI_Book_Coin),
RELATED('Date'[WeekYear]
= MIN('Date'[WeekYear]-1))
)
)
RETURN
IF(lastweekamount = 0, "N/A",
DIVIDE(SUM(Power_BI_Book_Coin[R_Coin_Cnt]) - lastweekamount, lastweekamount, 0)
)
 

 Thanks.

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi Anonymous ,

     

    Please use the below formula 

     

    Measure =
    VAR lastWeekAmount =
        CALCULATE (
            SUM ( Value Sum),
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[WeekNum]
                    = MIN ( 'Calendar'[WeekNum] ) - 1
            )
        )
    RETURN
        DIVIDE ( SUM ( Value Sum ) - lastWeekAmount, lastWeekAmount, 0 )

     

     

    Regards,

    Gaurav  Raj Singh

     

    LinkedIN : https://www.linkedin.com/in/gauravrajsingh/

     

     

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Please use the below formula 

     

    Measure =
    VAR lastWeekAmount =
        CALCULATE (
            SUM ( Value Sum),
            FILTER (
                ALL ( 'Calendar' ),
                'Calendar'[WeekNum]
                    = MIN ( 'Calendar'[WeekNum] ) - 1
            )
        )
    RETURN
        DIVIDE ( SUM ( Value Sum ) - lastWeekAmount, lastWeekAmount, 0 )

     

     

    Regards,

    Gaurav  Raj Singh

     

    LinkedIN : https://www.linkedin.com/in/gauravrajsingh/

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you very much for your help^^

       

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous 

         

        it worked ?