Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |