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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ziyabikram96
Helper V
Helper V

Dax Comparison Operators do not support comparing values of type integer with values of true/false

I am trying to calculate a measure where it has separate calculations for Friday and Sunday using Switch. I am using weekday() to separate Friday and Sunday. But, it is throwing the above mentioned error.

latee.PNGlate2.PNG

 

1 ACCEPTED SOLUTION

Replacing "<> OR(5,7)" with " <> 5 || 7" has resolved the issue

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@ziyabikram96 , seem like at some place int is getting compared with text

 

For work date related stuff check if this blog -https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calenda...

or video

https://youtu.be/58ps6QhXL30

can help

 

Replacing "<> OR(5,7)" with " <> 5 || 7" has resolved the issue

Greg_Deckler
Super User
Super User

@ziyabikram96 - It's hard to read your DAX, could you paste as text and replace the things you don't want us to see with placeholders/different names? I've seen this happen if you actually true to compare an integer with a boolean but also I've seen it when there is some kind of flaw in DAX/logic. But, very difficult to read.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

SWITCH(TRUE(),
              WEEKDAY(DISTINCT('SourceSheet'[Date]),2) <> OR(5,7), DATEDIFF(DISTINCT('SourceSheet'[In]),          DISTINCT('SourceSheet(PAK)'[On Duty]),MINUTE),
              WEEKDAY(DISTINCT('SourceSheet'[Date]),2) = 5,CALCULATE(DATEDIFF(DISTINCT('SourceSheet'[In]), TIME(14,00,00),MINUTE),'SourceSheet(PAK)'[Dept] == "abc"),
              WEEKDAY(DISTINCT('SourceSheet('[Date]),2) = 7,CALCULATE(DATEDIFF(DISTINCT('SourceSheet'[In]), TIME(16,00,00),MINUTE),'SourceSheet(PAK)'[Dept] == "abc"))
 
[In] and [On Duty] are time columns. I have tried using Value() with 5,7 and OR(5,7) but no progress

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.