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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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