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! Learn more

Reply
Anonymous
Not applicable

IF/Switch function not working in DirectQuery Mode

Hi Team,

 

I have a report in which I want the dataset to refresh every hour. Due to the 8 refresh limit in Import mode I had to use DirectQuery Mode. But now the IF function is not working properly. 

 

My IF function = IF(MAXX(Aggregation Count)<MAXX(Threshold),0,1)

 

This function works fine in Import Query mode. But in Direct Query mode its only giving 0 or NULL instead of 0 or 1. Can you advise here. 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

OK, so I seem to have found the solution which is even wierder. If I add a 3rd paramemter in the IF function then that gives "False" result properly. 

 

Working IF Function

IF(MAX(Registration)<MAX(Threshold),0,0,1)

This gives 0 if true and 1 if false.

 

Not working function

IF(MAX(Registration)<MAX(Threshold),0,1)

This gives 0 if true and BLANK if false.

 

NO idea why its doing this. Tried it on couple of machines and same result on all. 

 

 

View solution in original post

3 REPLIES 3
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

From the Microsoft official document DAX formula compatibility in DirectQuery mode, we know that function IF and SWITCH are supported in all DAX formulas, including measures, queries, calculated columns, row level security. While the MAXX function is only supported in measure and query formulas.

 

By my test in the latest version 2.74.5619.862 of Power BI Desktop, the function IF and SWITCH work well when using DirectQuery connect mode.

65.png

 

 

 

 

 

 

 

 

 

 

 

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Doesn't work for me.

 

My PBI desktop version -  2.74.5619.862

Not workingNot working

Anonymous
Not applicable

OK, so I seem to have found the solution which is even wierder. If I add a 3rd paramemter in the IF function then that gives "False" result properly. 

 

Working IF Function

IF(MAX(Registration)<MAX(Threshold),0,0,1)

This gives 0 if true and 1 if false.

 

Not working function

IF(MAX(Registration)<MAX(Threshold),0,1)

This gives 0 if true and BLANK if false.

 

NO idea why its doing this. Tried it on couple of machines and same result on all. 

 

 

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.

Top Solution Authors