cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors