Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Creating cumulative percentage

Hi i have the below table visual and i am looking at calculating the cumulative percentage. I created the below measure however its not calculating this properly. Can anyone please advise? 

 

  • Hi Anonymous 

    here is a sample. Adjust it for your needs:

     

     

    Running Percentage = 
    VAR _Total =
        CALCULATE ( [Waste Value], ALL ( 'Table' ) )
    VAR _Percentage =
        DIVIDE ( [Waste Value], [Total] )
    VAR _WasteValue =
        SUM ( 'Table'[Waste Value_] )
    RETURN
        IF (
            HASONEVALUE ( 'Table'[Loss Reason] ),
            CALCULATE (
                [Percentage],
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Waste Value_] >= MAX ( 'Table'[Waste Value_] )
                )
            )
        )

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi  Anonymous  ,

    Created some data:

    Here are the steps you can follow:

    1. Enter power query through Transform data, Add Column – Index Column –From 1.

    2. Create measure.

    Expected Output =
    var _1=SUMX(FILTER(ALLSELECTED('Table'),'Table'[Index]<=MAX('Table'[Index])),'Table'[Waste Value])
    var _2= SUMX(ALL('Table'),'Table'[Waste Value])
    return
    DIVIDE(_1,_2)

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • FrankAT's avatar
    FrankAT
    Community Champion

    Hi Anonymous 

    here is a sample. Adjust it for your needs:

     

     

    Running Percentage = 
    VAR _Total =
        CALCULATE ( [Waste Value], ALL ( 'Table' ) )
    VAR _Percentage =
        DIVIDE ( [Waste Value], [Total] )
    VAR _WasteValue =
        SUM ( 'Table'[Waste Value_] )
    RETURN
        IF (
            HASONEVALUE ( 'Table'[Loss Reason] ),
            CALCULATE (
                [Percentage],
                FILTER (
                    ALL ( 'Table' ),
                    'Table'[Waste Value_] >= MAX ( 'Table'[Waste Value_] )
                )
            )
        )

    With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
    FrankAT (Proud to be a Datanaut)

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous  ,

    Created some data:

    Here are the steps you can follow:

    1. Enter power query through Transform data, Add Column – Index Column –From 1.

    2. Create measure.

    Expected Output =
    var _1=SUMX(FILTER(ALLSELECTED('Table'),'Table'[Index]<=MAX('Table'[Index])),'Table'[Waste Value])
    var _2= SUMX(ALL('Table'),'Table'[Waste Value])
    return
    DIVIDE(_1,_2)

    3. Result:

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi Anonymous 

    You can use the following formula

     

    Regards,

    Sayali

    If this post helps, then please consider Accept it as the solution to help others find it more quickly

     
    **bleep** PCT = 

    var total =CALCULATE('Waste Data Measures'[Waste Value Total],REMOVEFILTERS('Waste Data Measures'[Loss Reason]))

    var cur = 'Waste Data Measures'[Waste Value Total]

    RETURN

    DIVIDE(cur,total,0)