cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

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
Super User IV
Super User IV

@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

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

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

View solution in original post

Super User IV
Super User IV

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

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors