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 moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hello
I'm attempting to create a custom column based on the values of two existing columns (Score, Name) however I only get zeroes when using the below query and can't understand why?
if [Score = "3" and [Name] = "RT01" then "This service has alot of radios" else if [Score] = "3" and [Name] = "RT02" then "This service has less radios" else if [Score] = "3" and [Name] = "J01" then "This service has alot of jobs" else if [Score] = "3" and [Name] = "J02" then "This service has less jobs" else 0
Solved! Go to Solution.
The first [Score is missing a ] but i assume that is a type. If the Score column is numeric you need just put the number without quotes - [Score] = 3
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
So we can see that all rows are falling through to the 'else' clause and returning 0.
If you want to debug this write a new, simple custom column with a single test - if, then, else
and try to make that work.
for example: if [Score] = "3" then "success" else "fail"
----
Looking at your code, I can guess that it may return all "fail" - see if you can make it work
The first [Score is missing a ] but i assume that is a type. If the Score column is numeric you need just put the number without quotes - [Score] = 3
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks, the removal of quotes helped but I only get a succesful outcome if the first IF statement is met. However if the second statement is met it doesn't work and gives me zeroes still. Is there something I need to do to ensure each statement is checked?
Nevermind it has actually worked, thanks so much!
Check out the April 2026 Power BI update to learn about new features.
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 |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |