Forum Discussion

NickTeam17's avatar
NickTeam17
Frequent Visitor
6 years ago
Solved

Calculating differences between multiple columns and then the median of these values

Hi

I have been asked to calculate the following three stage exercise:

  1. Calculate the differences between the weekly data in the table below
  2.  Calculate the median of those weekly differences for a specific week
  3. Calculate the movement in the median of weekly differences compared to the previous week

The above is an ongoing exercise each week so I suspect use of variable will be necessary.

 

 Week 1Week 2Week 3Week 4Week 5Week 6Week 7
Worms2345678
Overcooked11234567435456
The Survivalists34544345675456

 

I appreciate I could just do the calculations in excel and upload the weekly differences but believe there will be a solution just in Power BI.

 

 

  • NickTeam17

    I suggest you unpivot this data, which is done in the Power Query Editor.

    So to make it as dynamic as possible select all the columns that are NOT weeks, then select Unpivot Other Columns..

    Then you will have two columns: Attribute and Value. Rename Attribute to Week Number and Value to whatever you want.

    When you've got that under control, come back and see us if you need more help with calculating the average, difference and filtering by week, but this will be more straightforward once it's in columns.

    https://radacad.com/pivot-and-unpivot-with-power-bi

2 Replies