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

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
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.