Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Different Calculation Based on Value In Column

Hi,

 

I have a measures table that contains the below columns

 

KPI Name

Numerator

Denominator

IsRate

 

I would like to create a single Measure in Power BI that calculates a summarized value based on the value in IsRate. For example, if the value in IsRate = 'No', I would like to use SUM(Numerator). And if the value in IsRate = 'Yes', I would like to use SUM(Numerator)/SUM(Denominator).

 

I have tried multiple ways to do this but I can't get the syntax to work.  Any ideas?

 

TIA!

 

Dan

  • Anonymous , try like

     

    sumx(Table, if(Table[IsRate] = "No", SUM(Table[Numerator]),SUM(Table[Numerator])/SUM(Table[Denominator]))

    or

    if(max(Table[IsRate]) = "No", SUM(Table[Numerator]),SUM(Table[Numerator])/SUM(Table[Denominator]))

3 Replies

  • Anonymous , try like

     

    sumx(Table, if(Table[IsRate] = "No", SUM(Table[Numerator]),SUM(Table[Numerator])/SUM(Table[Denominator]))

    or

    if(max(Table[IsRate]) = "No", SUM(Table[Numerator]),SUM(Table[Numerator])/SUM(Table[Denominator]))

  • AntrikshSharma's avatar
    AntrikshSharma
    Community Champion
    Are you using IsRate in a slicer and based on its selection you want to change the calculation of the measure?