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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Measure with IF-else condition to choose another measure value

Hi

 

So here in my case, let us say the data is like this:

Series      Sales Amt    

A               1000

B               1200

C               1500

All             3600

 

So I need to calculate the total sales amount and share%. The total sales for series "All" depend on another measure X which calculates the sum of sales on another "segment" column filter when Segment = "All segments". The expectation for total sales is like this:

Series      Sales Amt    Total Sales 

A               1000           3600

B               1200           3600

C               1500           3600

All             3600           4000

 

So, for all other series, the total sales should be equal to the sales amt of "All" and for the series "All" the total sales are equal to the total sales when segment = "All segment". I have created two measures, Measure1  which gives me total sales as 3600 for all series and another measure Measure 2 which gives total sales when segment = "All segment".

 

I am creating a third measure for getting the desired value like the above table:

VAR IsSeries = IF(ISFILTERED(Table[Series])= "All" , True, False)
VAR Calc1 = [Measure 2]
VAR Calc2= [Measure 1]
Return IF(Isseries, Calc1, Calc2)

 

I am getting an error. kindly help how can write a conditional statement in measure to get the output correctly.

 

2 REPLIES 2
Anonymous
Not applicable

In your IF-statement there is no condition
IF(Isseries, Calc1, Calc2) - what is the condition to verify in order to choose between calc1 or calc 2?

Look at your first if-statement 

IF(ISFILTERED(Table[Series])= "All" , True, False) - here we have a condition, if Table[Series] is equal to "ALL" we put true, if not false.
The same logic must be in your first if-statement

For instance :

IF(Isseries=True(), Calc1, Calc2) 
So if Isseries is true than return calc 1, if not calc2

Anonymous
Not applicable

The description of the problem is about as clear as mud. No wonder nobody has written anything for 7 hours... Either you'll explain clearly what it is you want or you'll be waiting until the end of the world.

Best
D

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.