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

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

Reply
David01
Frequent Visitor

Dax not returning a value

I am having difficulty getting the following to work any help would be appreciated.

 

IF( MAX(Machine[Display])="Precision"
,CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"})
,CALCULATE( SUM(Manufacturing[TonnesMade])))

 

TRIED

 

VAR = CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"})

RETURN
IF( MAX(Machine[Display])="Precision"
,VAR
,CALCULATE( SUM(Manufacturing[TonnesMade])))


If I do the following

 

IF( MAX(Machine[Display])="Precision"
,12345.01
,CALCULATE( SUM(Manufacturing[TonnesMade])))

 

It returns the 12345.01 for Precision otherwise it wont even show Precision.


All other results are shown as expected for any of the variations I have tried.

 

The CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"}) does return a value if i use it in a card as a test

 

the table Manufacturing and Machine have a relationship one to many.

1 ACCEPTED SOLUTION

I changed this 
IF( MAX(Machine[Display])="Precision"
,CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"})
,CALCULATE( SUM(Manufacturing[TonnesMade])))

To

IF( MAX(Machine[Display])="Precision"
,CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"},

allexcept(Machine,Machine[Alt Name])

)
,CALCULATE( SUM(Manufacturing[TonnesMade])))

It now works as I required.

I will be the first to acknowledge I have no idea what the allexcept is acually doing.

Thanks for looking at this for me.

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@David01 , can share some visual screen shot. the above should work

 

Try this too

CALCULATE(SUM(Manufacturing[TonnesMade]),Filter(Machine,  Machine[Alt Name] IN {"MA","MB","MC","MD"}) )

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I changed this 
IF( MAX(Machine[Display])="Precision"
,CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"})
,CALCULATE( SUM(Manufacturing[TonnesMade])))

To

IF( MAX(Machine[Display])="Precision"
,CALCULATE(SUM(Manufacturing[TonnesMade]),Machine[Alt Name] IN {"MA","MB","MC","MD"},

allexcept(Machine,Machine[Alt Name])

)
,CALCULATE( SUM(Manufacturing[TonnesMade])))

It now works as I required.

I will be the first to acknowledge I have no idea what the allexcept is acually doing.

Thanks for looking at this for me.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.