Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Hi Team,
I have the below input and want to calculate variance based on the description column. also want the output to be in table or matrix form.
Input:
id | description | symptoms | conduct_problem | hyperactivity | problem | prosocial | impact | score |
150 | Start | 4 | 7 | 10 | 8 | 6 | 4 | 15 |
150 | End | 3 | 5 | 8 | 4 | 7 | 7 | 7 |
160 | Start | 7 | 3 | 5 | 7 | 4 | 10 | 18 |
160 | Start | 5 | 5 | 5 | 6 | 2 | 8 | 16 |
160 | End | 5 | 5 | 5 | 6 | 2 | 6 | 13 |
160 | End | 5 | 4 | 4 | 9 | 2 | 8 | 18 |
164 | Start | 7 | 2 | 2 | 5 | 6 | 10 | 19 |
164 | End | 5 | 4 | 2 | 5 | 8 | 7 | 14 |
173 | Start | 9 | 7 | 10 | 7 | 4 | 4 | 10 |
173 | End | 8 | 7 | 9 | 7 | 2 | 9 | 8 |
188 | Start | 7 | 3 | 7 | 0 | 9 | 6 | 9 |
188 | End | 7 | 3 | 5 | 0 | 6 | 5 | 16 |
189 | Start | 6 | 8 | 10 | 5 | 7 | 4 | 12 |
189 | End | 4 | 6 | 9 | 4 | 7 | 2 | 11 |
Expected output:
Scale | Start | End | diff |
symptoms | 6.43 | 5.29 | 1.14 |
conduct_problem | 5.00 | 4.86 | 0.14 |
hyperactivity | 7.00 | 6.00 | 1.00 |
problem | 5.43 | 5.00 | 0.43 |
prosocial | 5.43 | 4.86 | 0.57 |
impact | 6.57 | 6.29 | 0.29 |
score | 14.14 | 12.43 | 1.71 |
all Total | 50.00 | 44.71 | 5.29 |
Please not that the value of Start and End is the average value based on id column. and the all Total is the summantion of the 7 rows.
Is this possible in power bi?
Thanks in advance.
Solved! Go to Solution.
@P_P2595 , Unpivot the all column other than Id and description , then you can have measures like
M1 = calculate(Average(Table[Value]), filter(Table, Table[Description] ="Start") )
M2= calculate(Average(Table[Value]), filter(Table, Table[Description] ="End") )
Diff = [M1] -[M2]
Learn Power BI: Power Query UnPivot Data, Pivot Data, Transpose Data, Query Fill Up, Fill Down: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=36407s
Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RiGy6Yf6quAn_ATjG?e=zsB0R6
Hi,
Please find attached my solution file.
Hope this helps.
Hi all,
Thanks for your solutions and it’s working for me. Is it possible to get the same output without unpivoting the columns as I have some pages and visuals with that table and extra columns than the input data and I don't want to unpivot the data because it's affecting other pages and visuals.
Is there any other way to get the expected output by creating a measure and calculated column?
Thank you so much.
Greatly appreciate your answers.
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
https://1drv.ms/u/s!AiUZ0Ws7G26RiGy6Yf6quAn_ATjG?e=zsB0R6
@P_P2595 , Unpivot the all column other than Id and description , then you can have measures like
M1 = calculate(Average(Table[Value]), filter(Table, Table[Description] ="Start") )
M2= calculate(Average(Table[Value]), filter(Table, Table[Description] ="End") )
Diff = [M1] -[M2]
Learn Power BI: Power Query UnPivot Data, Pivot Data, Transpose Data, Query Fill Up, Fill Down: https://www.youtube.com/watch?v=cN8AO3_vmlY&t=36407s
Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
91 | |
74 | |
64 | |
49 | |
36 |
User | Count |
---|---|
115 | |
86 | |
80 | |
58 | |
39 |