Forum Discussion

bluetronics's avatar
bluetronics
Helper III
7 years ago
Solved

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 ...
  • LivioLanzo's avatar
    7 years ago

    bluetronics

     

    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] )
    )