Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I have to add a custom column called"Data" by using below switch case :
CASE
WHEN Ratio <= 0.05 THEN 5
WHEN (Ratio > 0.05) and (Ratio <= 0.1) THEN 4
WHEN (Ratio > 0.1) and (Ratio <= 0.2) THEN 3
WHEN (Ratio > 0.2) and (Ratio <= 0.3) THEN 2
WHEN Ratio > 0.3 THEN 1
END
Can someone please me with this.
Thanks.
Solved! Go to Solution.
Hi @Anonymous
Try this
Score = SWITCH( TRUE(),
[Nonstandard_Ratio] <= 0.05, 5,
AND([Nonstandard_Ratio] > 0.05, [Nonstandard_Ratio] <= 0.1), 4,
AND([Nonstandard_Ratio] > 0.1, [Nonstandard_Ratio] <= 0.2), 3,
AND([Nonstandard_Ratio] > 0.2, [Nonstandard_Ratio] <= 0.3), 2,
[Nonstandard_Ratio] > 0.3,1
)
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
Hi @amitchandak ,
I am getting this below error.
Note : In the below image i have used Nonstandard_Ratio(because that is my column name) instead of Ratio
Thanks.
Hi @Anonymous
Try this
Score = SWITCH( TRUE(),
[Nonstandard_Ratio] <= 0.05, 5,
AND([Nonstandard_Ratio] > 0.05, [Nonstandard_Ratio] <= 0.1), 4,
AND([Nonstandard_Ratio] > 0.1, [Nonstandard_Ratio] <= 0.2), 3,
AND([Nonstandard_Ratio] > 0.2, [Nonstandard_Ratio] <= 0.3), 2,
[Nonstandard_Ratio] > 0.3,1
)
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Proud to be a Super User!
@Anonymous , Try Switch, Create a new column
Switch( True()
[Ratio] <= 0.05 , 5,
([Ratio] > 0.05) && ([Ratio] <= 0.1) , 4,
([Ratio] > 0.1) && ([Ratio] <= 0.2) , 3,
([Ratio] > 0.2) && ([Ratio] <= 0.3) , 2,
[Ratio] > 0.3 , 1
)
refer video : https://www.youtube.com/watch?v=gelJWktlR80
Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |