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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
afmcjarre
Helper I
Helper I

How to Use Greater Than and Less Than in DAX Measure

I am really struggling how to properly create a measure just to create a simple measure to check row by row if a number is greater than or less 5.

 

I can't use "IF" because I get the error message about a single value, which I honestly don't understand.  

 

afmcjarre_0-1620664288941.png

 

As someone who mainly uses Power Query or calculated columns, I'm trying to figure out how to use DAX measures more.  But this same error really has me stuck!

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi, @afmcjarre 

I assume you want to create a new column.

please try the below formula for creating a new column.

 

New column =
IF (
CALCULATE ( SUM ( revisions_max_properties[Expiration-Inception] ) ) > 5,
TRUE,
FALSE
)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

dkaushik
Resolver II
Resolver II

In that case, you can add a calculated column, either in DAX or power query editor.

 

For DAX,

 

Column = if(column_name > 5, "True", "False")

dkaushik_0-1620666625401.png

 

Seel below article to know more about this:
Using calculated columns in Power BI Desktop - Power BI | Microsoft Docs

 

Thanks,

Dheeraj

View solution in original post

5 REPLIES 5
dkaushik
Resolver II
Resolver II

In that case, you can add a calculated column, either in DAX or power query editor.

 

For DAX,

 

Column = if(column_name > 5, "True", "False")

dkaushik_0-1620666625401.png

 

Seel below article to know more about this:
Using calculated columns in Power BI Desktop - Power BI | Microsoft Docs

 

Thanks,

Dheeraj

Okay perfect - thank you! I had done this already, just thought this could also be accomplished with a measure. Glad to know I was headed in the right direction. 

Jihwan_Kim
Super User
Super User

Hi, @afmcjarre 

I assume you want to create a new column.

please try the below formula for creating a new column.

 

New column =
IF (
CALCULATE ( SUM ( revisions_max_properties[Expiration-Inception] ) ) > 5,
TRUE,
FALSE
)

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


dkaushik
Resolver II
Resolver II

Hi @afmcjarre ,

 

Create a Measure as shown below and it will work just fine.

dkaushik_0-1620665053325.png

Regards,

Dheeraj

 

#Please mark as solution and give a big thumbs up if this helps.

 

Unfortunately SUM nor SUMX will work for this because that only gives me one result. I need a result for each row that can then be used in a final calulation. 

afmcjarre_0-1620666033808.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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