Forum Discussion

PhilST's avatar
PhilST
Regular Visitor
7 years ago
Solved

WoW trend calculation

Hi all,

 

I am working on a dashboard for some days now but I am unable to find a solution to my problem of including WoW changes for data on a weekly basis. I would love to include a third column to the right, that shows the WoW change.

 

The data I have is rather simple with the following two columns.

 

rec_week    receipts

201803       561

201804      1594

201805       846

201806       953

...

...

 

Thanks so much in advance! I checked several threads for this, but non worked somehow. I am relatively new to Power BI, btw.

 

Philipp

 

  • HI PhilST,

     

    If you just want to calculate the WoW add the following measure to your model then put it on a table visual.

     

    WoW =
    VAR weekselection =
        MAX ( Table1[rec_week] )
    RETURN
        SUM ( Table1[receipts] )
            - CALCULATE (
                SUM ( Table1[receipts] );
                FILTER ( ALL ( Table1[rec_week] ); Table1[rec_week] = weekselection - 1 )
            )

    Be aware that this won't work for previous year, do you need to pick from last week of previous year also?

     

    Regards,

    MFelix

7 Replies

  • HI PhilST,

     

    If you just want to calculate the WoW add the following measure to your model then put it on a table visual.

     

    WoW =
    VAR weekselection =
        MAX ( Table1[rec_week] )
    RETURN
        SUM ( Table1[receipts] )
            - CALCULATE (
                SUM ( Table1[receipts] );
                FILTER ( ALL ( Table1[rec_week] ); Table1[rec_week] = weekselection - 1 )
            )

    Be aware that this won't work for previous year, do you need to pick from last week of previous year also?

     

    Regards,

    MFelix

    • PhilST's avatar
      PhilST
      Regular Visitor

       MFelix,

       

      Thanks for the quick response!

       

      I get the following error message when adding the measure you proposed:

      "The syntax for ';' is incorrect. (DAX(VAR weekselection = MAX ( Table1[rec_week] )RETURN SUM ( Table1[receipts] ) - CALCULATE ( SUM ( Table1[receipts] ); FILTER ( ALL ( Table1[rec_week] ); Table1[rec_week] = weekselection - 1 ) )))."

       

      Is there something I should adapt in the measure that you proposed or prepare beforehand?

       

      I would need the same for YoY data, yep...

       

      Thanks in advance!

      Philipp

      • MFelix's avatar
        MFelix
        Icon for Super User rankSuper User

        Hi PhilST

         

        Replace the dot comma ";" by comma "," should work as to do with DAX sintax and OS regional settings in my case it's dot comma.