Forum Discussion
Help to calculate Commulative %
- Anonymous4 years ago
Hi Anonymous ,
What connection mode data source your report is connected to? I saw you mention that you can't create additional tables in DM, is the data source in DQ or LC connection mode? Or are you unable to create additional tables in DM for some other reason?
I have created an sample pbix file(see attachment), please check if it is what you want.
1. Create a calculated column to get the index base on Root Category and Category fields (It is necessary for the cumulative calculation later, use it as a base column for the cumulative calculation)Index = RANKX ( 'Table', 'Table'[Category],, ASC, DENSE )2. Create two measures to get the cumulative value and cumulative percentage respectively
Cumulative Total = VAR _tab = SUMMARIZE ( 'Table', 'Table'[Root Category], 'Table'[Category], "@sumofid", CALCULATE ( SUM ( 'Table'[ID] ), FILTER ( ALLEXCEPT('Table','Table'[Root Category]), 'Table'[Index] <= SELECTEDVALUE ( 'Table'[Index] ) ) ) ) RETURN MAXX ( _tab, [@sumofid] )Cumulative Percentage = DIVIDE ( [Cumulative Total], CALCULATE ( SUM ( 'Table'[ID] ), ALLEXCEPT ( 'Table', 'Table'[Root Category] ) ), 0 )Best Regards
Anonymous Not getting you exactly. Just write SUM(TableName[Column Name]) to get the value.
Hi Tahreem,
Please find saple raw data attached.
| Root Category | Category | ID |
| A | A1 | 2 |
| A | A2 | 3 |
| A | A1 | 4 |
| A | A3 | 5 |
| A | A3 | 6 |
| A | A1 | 7 |
| A | A3 | 8 |
| A | A3 | 9 |
| A | A3 | 10 |
| A | A3 | 11 |
| A | A1 | 12 |
| A | A3 | 13 |
| A | A1 | 14 |
| A | A1 | 15 |
| A | A3 | 16 |
And requirement is create below table
| Root Category | Category | Count of ID | Cumulative Total | Cumulative Percentage |
| A | A1 | 142 | 142 | 52% |
| A2 | 69 | 211 | 77% | |
| A3 | 25 | 236 | 86% | |
| A4 | 17 | 253 | 92% | |
| A5 | 16 | 269 | 98% | |
| A8 | 5 | 274 | 100% |
- CNENFRNL4 years agoCommunity Champion
Due to intrinsic attribute of VertiPaq engine under the hood in PBI, rows are not literally ordinal in a table; that's to say, A1 doesn't preceed A2 at all. You must manually assign orders among categories.
- Anonymous4 years agoNot applicable
Hi, Thank you for suporting.
How do we rank category in below case.
Root Category Category ID A Cat 2 A Cat 12 A Cat 22 A Rat 4 A Tiger 5 A Lion 6 A Rat 34 A Tiger 55 A Pig 7 B Cat 8 B Rat 9 B Tiger 10 B Lion 11 B Pig 15 B Cat 18 B Rat 39 B Tiger 70 - CNENFRNL4 years agoCommunity Champion
Exactly the same pattern,