Forum Discussion
Custom / hybrid / dynamic Matrix
Hi all,
I am strugling to build a custom matrix, I have found some similar topics but I could not figure how to adapt it to my issue.
I already checked the following examples :
https://community.powerbi.com/t5/Community-Blog/Creating-a-custom-or-hybrid-matrix-in-PowerBI/ba-p/1354591 PaulDBrown
https://powerbi.tips/2019/07/the-dynamic-time-matrix/
https://exceleratorbi.com.au/building-a-matrix-with-asymmetrical-columns-and-rows-in-power-bi/
All the examples above have 1 level column header calculation.
So here is my example:
Input data :
Table 1 from an excel sheet.
| Table 1 | |||
| Date | Label | code Count | No of Lines |
| 09/01/2022 | Product 1 | 1 | 1 |
| 09/01/2022 | Product 1 | 1 | 1 |
| 15/01/2022 | Product 1 | 1 | 1 |
| 15/01/2022 | Product 1 | 1 | 1 |
| 30/01/2022 | Product 1 | 1 | 10 |
| 10/02/2022 | Product 1 | 60 | 1 |
| 10/05/2022 | Product 1 | 10 | 1 |
| 09/07/2022 | Product 2 | 1 | 1 |
| 09/09/2022 | Product 2 | 50 | 1 |
| 09/01/2023 | Product 3 | 1 | 50 |
| 09/02/2023 | Product 3 | 0 | 1 |
| 10/02/2023 | Product 5 | 1 | 1 |
| 09/03/2023 | Product 3 | 0 | 30 |
| ... | ... | ... | ... |
Table 2 from another excel sheet, which have the Label column in common
| Table 2 | |
| Label | Target2023 |
| Product 1 | 60% |
| Product 2 | 70% |
| Product 3 | 80% |
| Product 4 | 80% |
| Product 5 | 95% |
| Product 6 | 60% |
| Product 7 | 50% |
| Total | 89% |
Output:
In Excel, it can be done with a basic pivot table (at least the part without the target).
The calculations for the columns are :
item = sum(No of Lines)
late = sum(No of Lines) - sum(Code Count)
percent = sum(No of Lines) / sum(Code Count)
The month should evolve dynamically (if there is a new data in a new month, the new month for the actual year should appear and added in the total calculation of the new year). (Like https://powerbi.tips/2019/07/the-dynamic-time-matrix/)
A variation can be proposed regarding the column header like the following:
2 Replies
- PaulDBrownCommunity Champion
Apologies upfront because I'm really pushed for time, so cannot go into detail about how to build the model for 2 level headers. Please check the following file to see if it helps in any way (file attached)
- nasreuNew Member
Hi,
Thank you for the file, I will try and check if it can help me.
If anyone has other tips, please feel free to answer.
Thanks again.