Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
danielreber
Regular Visitor

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

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@danielreber , 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]))

View solution in original post

3 REPLIES 3
AntrikshSharma
Community Champion
Community Champion

Are you using IsRate in a slicer and based on its selection you want to change the calculation of the measure?
amitchandak
Super User
Super User

@danielreber , 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]))

@amitchandak That worked. Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.