Forum Discussion
How to stack or group table with related data
Hello, the table at the top below shows how I currently have a table visual in my file. The info in the table is pulled from a variety of sources (some from various tables and some from measures). Is there a way I can stack or group related items in a table so I can have the percentages show under the actual value (example on bottom table)? This would help in formatting my dashboard.
char23 , Check if double unpivot can help in getting data in a different format, and later you can get measures for that format , You might need calculation group too
Double Unpivot and Reshape Data for Analysis in Power BI| Unpivot Column Set: https://www.youtube.com/watch?v=Diazpx1Nfec&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1
- Anonymous2 years ago
amitchandak Thanks for your contribution on this thread.
Hi char23 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a status dimension table
2. Create two measures as below
Measure = VAR _status = SELECTEDVALUE ( 'Status'[Status] ) RETURN SWITCH ( _status, "Completed", SUM ( 'Table'[Completed] ), "Not Finished", SUM ( 'Table'[Not Finished] ), "Late", SUM ( 'Table'[Late] ) )Measure% = VAR _status = SELECTEDVALUE ( 'Status'[Status] ) RETURN SWITCH ( _status, "Completed", DIVIDE ( SUM ( 'Table'[Completed] ), CALCULATE ( SUM ( 'Table'[Completed] ), ALLSELECTED ( 'Table'[Month] ) ) ), "Not Finished", DIVIDE ( SUM ( 'Table'[Not Finished] ), CALCULATE ( SUM ( 'Table'[Not Finished] ), ALLSELECTED ( 'Table'[Month] ) ) ), "Late", DIVIDE ( SUM ( 'Table'[Late] ), CALCULATE ( SUM ( 'Table'[Late] ), ALLSELECTED ( 'Table'[Month] ) ) ) )3. Create a matrix visual
Best Regards
2 Replies
- amitchandakSuper User
char23 , Check if double unpivot can help in getting data in a different format, and later you can get measures for that format , You might need calculation group too
Double Unpivot and Reshape Data for Analysis in Power BI| Unpivot Column Set: https://www.youtube.com/watch?v=Diazpx1Nfec&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L&index=1
- AnonymousNot applicable
amitchandak Thanks for your contribution on this thread.
Hi char23 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a status dimension table
2. Create two measures as below
Measure = VAR _status = SELECTEDVALUE ( 'Status'[Status] ) RETURN SWITCH ( _status, "Completed", SUM ( 'Table'[Completed] ), "Not Finished", SUM ( 'Table'[Not Finished] ), "Late", SUM ( 'Table'[Late] ) )Measure% = VAR _status = SELECTEDVALUE ( 'Status'[Status] ) RETURN SWITCH ( _status, "Completed", DIVIDE ( SUM ( 'Table'[Completed] ), CALCULATE ( SUM ( 'Table'[Completed] ), ALLSELECTED ( 'Table'[Month] ) ) ), "Not Finished", DIVIDE ( SUM ( 'Table'[Not Finished] ), CALCULATE ( SUM ( 'Table'[Not Finished] ), ALLSELECTED ( 'Table'[Month] ) ) ), "Late", DIVIDE ( SUM ( 'Table'[Late] ), CALCULATE ( SUM ( 'Table'[Late] ), ALLSELECTED ( 'Table'[Month] ) ) ) )3. Create a matrix visual
Best Regards