Forum Discussion
Median value calculation
I am calculating the median value for some weekly game sales in the table below:
| Game | Week 1 | Week 2 | Week 3 | Week 4 | Week 5 |
| Worms | 2 | 4 | 6 | 8 | 10 |
| The Escapists | 3 | 6 | 9 | 12 | 15 |
| Overcooked | 5 | 6 | 2 | 3 | 7 |
| Blasphemous | 8 | 1 | 2 | 7 | 9 |
I can transpose the data which puts the weekly data into columns for each game. I then introduced a new measure to calculate the median value for each game. Four different measures.
I want to have one single Median measure which gives me the median value for each game which I can drag into the above table.
Please could you help.
NickTeam17 - If you unpivot your week columns so that you end up with:
Game,Week,Value
Then you can create a single measure to calculate your median and then you would put Game and Median into a visual together.
3 Replies
- amitchandakSuper User
NickTeam17 , I think you need to unpivot not transpose
https://radacad.com/pivot-and-unpivot-with-power-bi
Transpose: https://yodalearning.com/tutorials/power-query-helps-transposing-data/then use
https://docs.microsoft.com/en-us/dax/median-function-dax
- Greg_DecklerCommunity Champion
NickTeam17 - If you unpivot your week columns so that you end up with:
Game,Week,Value
Then you can create a single measure to calculate your median and then you would put Game and Median into a visual together.
- NickTeam17Frequent Visitor
That works beautifully!!!
Thank you both very much.