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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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!:
Mastering Power BI 2nd Edition

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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