Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
How do I convert this statement from sql to dax?
case
when dc_q.currency_code ='-1'
then dc_a.currency_code
when dc_q.currency_code is null
then dc_a.currency_code
else dc_q.currency_code
end as PNRCurrencyCode,
@amitchandak Thank you for the quick response. this is the error I get when inputing the above statement:
The syntax for 'dc_q' is incorrect. (DAX(Switch( True(),(dc_q[currency_code]) ="-1" , dc_a[currency_code],Isblank(dc_q[currency_code)], dc_a[currency_code]dc_q[currency_code]))).
@Anonymous , the Second line seems to have an issue, Please find the correction
Switch( True(),
dc_q[currency_code] ="-1" , dc_a[currency_code],
Isblank( dc_q[currency_code]) , dc_a[currency_code],
dc_q[currency_code]
)
I tried the formula above and I still get the error below:
A single value for column 'currency_code' in table 'dc_q' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
@Anonymous , See like a new column code, use switch
PNRCurrencyCode =
Switch( True(),
dc_q[currency_code] ="-1" , dc_a[currency_code],
Isblank(dc_q[currency_code)], dc_a[currency_code]
dc_q[currency_code]
)
Switch-Case statement of #PowerBI: https://www.youtube.com/watch?v=gelJWktlR80&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=56
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 35 | |
| 33 | |
| 32 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 96 | |
| 77 | |
| 67 | |
| 65 |