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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
stribor45
Post Prodigy
Post Prodigy

Result should be true/false

Can someone comment on why this function is returning a value that looks like a date when it should return false?

 

stribor45_0-1689356486392.png

 

2 ACCEPTED SOLUTIONS

@stribor45 Where exactly are you specifying that it is a true/false measure? Everything in the DAX is dealing with dates so you are likely running into the fact that DAX is a dynamically typed language and weakly typed. DAX tries to do a lot of guessing and automatic type conversion so it's likely that in DAX Studio or whatever you are in it's guessing that it should be returning a date or alternatively it's some kind of bug in DAX Studio. You'd have to ask @marcorusso about that though. However, I don't think it is a bug. Your first row returns a date for the second column, the maximum month in your Date table so I'm willing to bet that DAX is then guessing that the column is a date column and there you have it. Did you instead mean to return X for the second column in your first row?

 

In Power BI Desktop, if you copied the DAX code to create a table you could change the column to a boolean type and the problem would go away maybe, not sure what it would do with that first row second column value as is. Probably call it true since it is non-zero.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

marcorusso
Most Valuable Professional
Most Valuable Professional

@Greg_Deckler is right, a column must have a single data type. It is the DAX engine that decides what data type to use, other tools (such as Power BI Desktop, DAX.DO, and DAX Studio) simply display the result produced by the query, but the decision is made by the DAX engine.

View solution in original post

5 REPLIES 5
marcorusso
Most Valuable Professional
Most Valuable Professional

@Greg_Deckler is right, a column must have a single data type. It is the DAX engine that decides what data type to use, other tools (such as Power BI Desktop, DAX.DO, and DAX Studio) simply display the result produced by the query, but the decision is made by the DAX engine.

Greg_Deckler
Super User
Super User

@stribor45 It's returning false or 0 which in terms of a date is December 30th, 1899



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Why is it returning it as a date when this is a function that returns true/false?

@stribor45 Where exactly are you specifying that it is a true/false measure? Everything in the DAX is dealing with dates so you are likely running into the fact that DAX is a dynamically typed language and weakly typed. DAX tries to do a lot of guessing and automatic type conversion so it's likely that in DAX Studio or whatever you are in it's guessing that it should be returning a date or alternatively it's some kind of bug in DAX Studio. You'd have to ask @marcorusso about that though. However, I don't think it is a bug. Your first row returns a date for the second column, the maximum month in your Date table so I'm willing to bet that DAX is then guessing that the column is a date column and there you have it. Did you instead mean to return X for the second column in your first row?

 

In Power BI Desktop, if you copied the DAX code to create a table you could change the column to a boolean type and the problem would go away maybe, not sure what it would do with that first row second column value as is. Probably call it true since it is non-zero.



Follow on LinkedIn
@ 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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler That makes sense. No first row is showing as intended. Thank you for explaining this. Much appreciated

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.