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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Less than and greater than value and assigning description

Hello everyone,

 

New to the forum and first post. I was wondering which command to use to get the following results in power bi.

 

I am comparing scores to see if they are less than or greater than a certain range and thus helping with the decision/outome. The excel formula is working, how can i set up the same in Power bi. below is a screenshot showing the formula etc 

musavengana_0-1665056259167.png

 

1 ACCEPTED SOLUTION
AnkitKukreja
Super User
Super User

Hi! @Anonymous 

 

You can add the custom column and use the below m code to check if it fits your requirements.

 

= Table.AddColumn(#"Changed Type", "Decision", each
if ( [Speed Rating] > 2.99 and [Speed Rating] < 6.0 and
[Safety Rating] > 2.99 and [Safety Rating] < 6.0 )
then "Commit"
else
if ( [Speed Rating] > 0 and [Speed Rating] < 2.98 and
[Safety Rating] > 2.99 and [Safety Rating] < 6.0 )
then "Consider"
else
if ( [Speed Rating] > 0 and [Speed Rating] < 2.98 and
[Safety Rating] > 0 and [Safety Rating] < 2.98 )
then "Delay"
else "Drop")

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

If you want a calculated column:

Decision = 
SWITCH (
    TRUE (),
    'Table'[Speed rating] > 2.99
        && 'Table'[Speed rating] < 6
        && 'Table'[Safety rating] > 2.99
        && 'Table'[Safety rating] < 6, "Commit",
    'Table'[Speed rating] > 0
        && 'Table'[Speed rating] < 2.98
        && 'Table'[Safety rating] > 2.99
        && 'Table'[Safety rating] < 6, "Consider",
    'Table'[Speed rating] > 0
        && 'Table'[Speed rating] < 2.98
        && 'Table'[Safety rating] > 0
        && 'Table'[Safety rating] < 2.98, "Delay",
    'Table'[Speed rating] > 2.99
        && 'Table'[Speed rating] < 6
        && 'Table'[Safety rating] > 0
        && 'Table'[Safety rating] < 2.5, "Drop"
)

vcgaomsft_0-1665393997170.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Anonymous
Not applicable

Thank you @Anonymous . I will also try above and will provide feedback. Thank you. 

Anonymous
Not applicable

Hi @Anonymous ,

Any update?

 

Best Regards,
Gao

Community Support Team

Anonymous
Not applicable

Thank you Ankit. I will apply above and will let you know the result.

 

Is there anything special I need to do first if those columns are copied from two different tables?

Hi! @Anonymous 

 

Nothing major. Just go to Power query into your data table and choose to add the custom column and paste this code. You will get a new custom column based on this code.

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904
AnkitKukreja
Super User
Super User

Hi! @Anonymous 

 

You can add the custom column and use the below m code to check if it fits your requirements.

 

= Table.AddColumn(#"Changed Type", "Decision", each
if ( [Speed Rating] > 2.99 and [Speed Rating] < 6.0 and
[Safety Rating] > 2.99 and [Safety Rating] < 6.0 )
then "Commit"
else
if ( [Speed Rating] > 0 and [Speed Rating] < 2.98 and
[Safety Rating] > 2.99 and [Safety Rating] < 6.0 )
then "Consider"
else
if ( [Speed Rating] > 0 and [Speed Rating] < 2.98 and
[Safety Rating] > 0 and [Safety Rating] < 2.98 )
then "Delay"
else "Drop")

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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