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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Sweetie
New Member

DAX Comparison operators

Hi, 

 

I am trying to compare a measure value with null("") through OR condition 

 

Ex:Measure = if(precreatedMeasure1 = "" || precreatedmeasure2 =0, "",sum(columndata)).

 

There is no error in syntax 

But doesn't support for visuals 

It says "DAX COMPARISON OPERATORS DO NOT SUPPORT COMPARING VALUES OF TYPE TEXT" 

(NULL is considered as text here )

can I please find any solution to compare with null values.

1 ACCEPTED SOLUTION

DAX uses BLANK() for database nulls.

You can try above code it will resolve your issue and you can also refer below article.

https://docs.microsoft.com/en-us/dax/blank-function-dax

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

4 REPLIES 4
Samarth_18
Community Champion
Community Champion

Can you try below code

Measures =
IF (
OR ( precreatedMeasure1 = BLANK (), precreatedmeasure2 = 0 ),
BLANK (),
SUM ( columndata )
)

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi @Samarth_18 ,

 

I was going through 

@https://youtu.be/C26DQkb4hy where in got to know Blank( ) and Null aren't same! 

So do we have any possibilities to compare a value with null.

If we have such It would be really helpful.

 

 

 

DAX uses BLANK() for database nulls.

You can try above code it will resolve your issue and you can also refer below article.

https://docs.microsoft.com/en-us/dax/blank-function-dax

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Hi @Samarth_18 ,

 

Thanks for your reply, I could understand now that Blank( ) and null aren't same but DAX treats them as same. 

And yes, DAX COMPARISON OPERATORS works fine when comparing with Blank( ).

 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors