cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User III
Super User III

Why does NOT() prevent converting boolean to numerical values? DAX Mysteries

edhans_0-1601437980296.png

In the above image, I can convert the True/False in the [Value] column to a number by multiplying by 1. Great.

edhans_1-1601438033769.png

However, as shown above, if I wrap [Value] with NOT(), thus changing true to false and false to true, I can not convert it to a number by multiplying by 1. It stays as a true/false value.

Why is that? What am I missing?

 

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Why does NOT() prevent converting boolean to numerical values? DAX Mysteries

Hi @edhans 

I followed your steps and got the same result.

What I noticed is that the data type still remained "True/False" instead os changing to Whole number unlike for "Column".

pranit828_1-1601440074711.png

Changing it to Whole number serves the purpose.

pranit828_2-1601440113372.png

As to why it is behaving in such way still might be a question as it follows the similar construct as "Column".

This might have to do with how Power BI internally finalises the data type.

 


Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit


View solution in original post

Highlighted
Super User III
Super User III

Re: Why does NOT() prevent converting boolean to numerical values? DAX Mysteries

Interesting @pranit828 - good catch on the data type. I also found out that if I used it as an operator and not as a function it works without having to change the data type.

edhans_0-1601464972477.png

And, of course, I hit this behavior inside of a measure where you cannot change the data type, nor could you deeper in a more detailed function even inside of a calculated column. But good thinking!



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

2 REPLIES 2
Highlighted
Community Champion
Community Champion

Re: Why does NOT() prevent converting boolean to numerical values? DAX Mysteries

Hi @edhans 

I followed your steps and got the same result.

What I noticed is that the data type still remained "True/False" instead os changing to Whole number unlike for "Column".

pranit828_1-1601440074711.png

Changing it to Whole number serves the purpose.

pranit828_2-1601440113372.png

As to why it is behaving in such way still might be a question as it follows the similar construct as "Column".

This might have to do with how Power BI internally finalises the data type.

 


Hope it resolves your issue? Please consider accepting it as the solution to help the other members find it more quickly.


Appreciate your Kudos, Press the thumbs up button!!👍


Regards,
Pranit


View solution in original post

Highlighted
Super User III
Super User III

Re: Why does NOT() prevent converting boolean to numerical values? DAX Mysteries

Interesting @pranit828 - good catch on the data type. I also found out that if I used it as an operator and not as a function it works without having to change the data type.

edhans_0-1601464972477.png

And, of course, I hit this behavior inside of a measure where you cannot change the data type, nor could you deeper in a more detailed function even inside of a calculated column. But good thinking!



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

Helpful resources

Announcements
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!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors