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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lmondavi
Frequent Visitor

If statement in calculate Measure

Hi, looking for some help with a measure. I have a measure that sums a Value based on criteria filters in the Calculate statement.  I would like the measure to calculate differently (to drop one of the criteria filters) based on one of the page slicers selection. The syntax that works fine is:

FH_VALUE = Calculate(sum(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",'Product'[System]="Sample",Funnel[HubSpoke]="No") 

 

There is a slicer on the page for [Segment]. In case Segment="EA", then I want the measure to drop the [System] filter:

Calculate(sum(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",Funnel[HubSpoke]="No") 

 

However, I can't use a normal IF statement because the [Segment] occurs as a column and is not aggregated. 

Thanks in advance for any help or better ideas you may have!

 

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @lmondavi

 

Does something like this help?

 

FH_VALUE = 

VAR IsEASelected = IF(ISFILTERED('Product'[Segment]) && MAX('Product'[Segment]) = "EA" , True,False)
VAR Calc1 = Calculate(SUM(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",'Product'[System]="Sample",Funnel[HubSpoke]="No")
VAR Calc2 = Calculate(SUM(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",Funnel[HubSpoke]="No")
RETURN IF(IsEASelected,Calc1,Calc2)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @lmondavi

 

Does something like this help?

 

FH_VALUE = 

VAR IsEASelected = IF(ISFILTERED('Product'[Segment]) && MAX('Product'[Segment]) = "EA" , True,False)
VAR Calc1 = Calculate(SUM(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",'Product'[System]="Sample",Funnel[HubSpoke]="No")
VAR Calc2 = Calculate(SUM(Funnel[Value]),Funnel[HalfInclusion]=1,Funnel[Forecast]="Commit",Funnel[HubSpoke]="No")
RETURN IF(IsEASelected,Calc1,Calc2)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

How would I expand this to more than just two values? It seems that with the MAX and RETURNIF statements that you would be confined to using only two variables. 

Thank you, worked like a charm!!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors
Users online (16,902)