Forum Discussion
Need to create a Matrix table
I have one more problem not getting the desired o/p:
I have dataset with two columns and need to create a table with Top 3 values then percentage of counts of respective values abd then need to calculate same with last 6 months.
Sample dataset
| Date | B | C | ||
| 2022-05-18 | 8 | W | ||
| 2022-05-05 | 8 | W | ||
| 2022-04-05 | 8 | W | ||
| 2022-04-05 | 8 | W | ||
| 2022-01-05 | 8 | W | ||
| 2022-01-01 | 10 | W | ||
| 2022-01-24 | 8 | BL | ||
| 2022-01-10 | 8 | BL | ||
| 2022-01-01 | 8 | BL | ||
| 2022-03-27 | 6 | W | ||
| 2022-02-05 | 8 | W | ||
| 2022-01-26 | 8 | W | ||
| 2022-01-27 | 8 | GR | ||
| 2022-01-11 | 8 | W | ||
| 2022-05-03 | 8 | W | ||
| 2022-02-03 | 8 | W | ||
| 2022-04-18 | 6 | W | ||
| 2022-03-31 | 8 | W | ||
| 2022-05-16 | 8 | W | ||
| 2022-02-08 | 8 | W | ||
| 2022-01-06 | 6 | R | ||
| 2022-02-07 | W |
O/P -
| Top 3 | B | B | B | C | C | C |
| Type | 8 | 6 | 10 | W | BL | GR |
| Percentage | ||||||
| Percentage L6Months |
I have created a calculated column of different columns in seperate table
For Column B -
Hi SK87 ,
I created a sample pbix file(get it from this link) for you, please check whether that is what you want. You can create measures as below to get it:
1. Create a measure as below to get the count of B
CountB = CALCULATE ( COUNT ( 'Data'[B] ), FILTER ( 'Data', 'Data'[B] = SELECTEDVALUE ( 'Data'[B] ) && NOT ( ISBLANK ( 'Data'[B] ) ) ) )2. Create a measure as below to get the rank for B
RankB = RANKX ( ALLSELECTED ( 'Data'[B] ), [CountB],, DESC, DENSE )3. Create a measure as below to get the percentage for B
PercentageB = VAR _allcount = CALCULATE ( COUNT ( 'Data'[B] ), FILTER ( ALLSELECTED ( Data ), NOT ( ISBLANK ( 'Data'[B] ) ) ) ) RETURN DIVIDE ( [CountB], _allcount, 0 )4. Create a matrix visal and apply a visual-level filter with the condition ([RankB] is less than or equal to 3)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
2 Replies
- SK87Helper III
- luohenResolver II
Hi SK87 ,
I created a sample pbix file(get it from this link) for you, please check whether that is what you want. You can create measures as below to get it:
1. Create a measure as below to get the count of B
CountB = CALCULATE ( COUNT ( 'Data'[B] ), FILTER ( 'Data', 'Data'[B] = SELECTEDVALUE ( 'Data'[B] ) && NOT ( ISBLANK ( 'Data'[B] ) ) ) )2. Create a measure as below to get the rank for B
RankB = RANKX ( ALLSELECTED ( 'Data'[B] ), [CountB],, DESC, DENSE )3. Create a measure as below to get the percentage for B
PercentageB = VAR _allcount = CALCULATE ( COUNT ( 'Data'[B] ), FILTER ( ALLSELECTED ( Data ), NOT ( ISBLANK ( 'Data'[B] ) ) ) ) RETURN DIVIDE ( [CountB], _allcount, 0 )4. Create a matrix visal and apply a visual-level filter with the condition ([RankB] is less than or equal to 3)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards