Forum Discussion
bluetronics
7 years agoHelper III
Cummulative Percentage by group
Hello All, I would like to get the result the same as tabel below: I can get total by customer, rank and % by Rank. but I donlt know how to get "cummulative % by rank". Pls. instruct me how to get ...
- 7 years ago
You can do it like this:
VAR CurSales = CALCULATE( SUM( Data[sales] ), ALLEXCEPT( Data, Data[Customer] ) ) RETURN DIVIDE( CALCULATE( SUM( Data[sales] ), FILTER( ALL( Data[Customer] ), CALCULATE( SUM( Data[sales] ), ALLEXCEPT( Data, Data[Customer] ) ) >= CurSales ), ALL( Data ) ), SUM( Data[sales] ) )
LivioLanzo
7 years agoSolution Sage
You can do it like this:
VAR CurSales = CALCULATE(
SUM( Data[sales] ),
ALLEXCEPT( Data, Data[Customer] )
)
RETURN
DIVIDE(
CALCULATE(
SUM( Data[sales] ),
FILTER(
ALL( Data[Customer] ),
CALCULATE(
SUM( Data[sales] ),
ALLEXCEPT( Data, Data[Customer] )
) >= CurSales
),
ALL( Data )
),
SUM( Data[sales] )
)bluetronics
7 years agoHelper III
Thank you for your feedback. I did the script but there is syntex error. Did I something wrong?
- v-yuta-msft7 years agoCommunity Support
Hi bluetronics,
You should add a column name before the formula.(e.g.:
cummulative % by Rank_ =VAR CurSales =............)
Regards,
Jimmy Tao
- bluetronics7 years agoHelper III
Thanks a lot! it works. :-)