Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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
Solved! Go to Solution.
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")
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"
)
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
Thank you @Anonymous . I will also try above and will provide feedback. Thank you.
Hi @Anonymous ,
Any update?
Best Regards,
Gao
Community Support Team
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.
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")
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
21 | |
11 | |
10 | |
10 | |
8 |