Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
22 | |
7 | |
6 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |