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 , Create 2 measures like below:
- Anonymous4 years agoNot applicable
Hi Tahreem.
"Count of ID" is not a direct field.
Count of ID = Count(ID). how to use this in above expression.
Thanks in Advance
- Tahreem244 years agoSuper User
Anonymous Not getting you exactly. Just write SUM(TableName[Column Name]) to get the value.
- Anonymous4 years agoNot applicable
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%