Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Percentage calculation

Hi all,

 

                           Pecentage calculation need to do for the report .

Calcualtion is for state with CA only.

Percenatge=( sum(value)/2000)*100

2000(constant value )

 

 

plse help?

 

 

  • Hi Anonymous ,

     The measures below are one way to do this. You could combine the measures together in a single measure.

    Please consider accepting as solution if this answers the question.

     
    CA Total = CALCULATE(SUM(Table_[value]), FILTER(ALL(Table_),Table_[state]="CA"))
    --This is the total value of all "CA" state rows
     
    CA Value = CALCULATE(SUM(Table_[value]), FILTER(Table_,Table_[state]="CA"))
    --This is the row value where state= "CA"
     
    CA Percentage = DIVIDE([CA Value],[CA Total],0)
    --This gets the percentage
     

     

2 Replies

  • Hi Anonymous ,

     The measures below are one way to do this. You could combine the measures together in a single measure.

    Please consider accepting as solution if this answers the question.

     
    CA Total = CALCULATE(SUM(Table_[value]), FILTER(ALL(Table_),Table_[state]="CA"))
    --This is the total value of all "CA" state rows
     
    CA Value = CALCULATE(SUM(Table_[value]), FILTER(Table_,Table_[state]="CA"))
    --This is the row value where state= "CA"
     
    CA Percentage = DIVIDE([CA Value],[CA Total],0)
    --This gets the percentage
     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Is this your expected output?

    (122222+200000+300000)/2000*100=31111

    If so, please try this measure:

    Percenatge = 
    VAR _total = CALCULATE(SUM('Table'[Value]),'Table'[State]="CA")
    VAR _result = DIVIDE(_total,2000)*100
    RETURN
    _result

    If I have misunderstood your needs, please feel free to contact us.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data