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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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