Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Very new to DAX & expect this is quite simple
I have some currency columns in my data set that have base currency values & local currency
e.g
Haulage
Haulage_Base
TotalCost
TotalCost_base
etc
I want to create a Custom column that outputs either the local currency or base currency value based on an idSite in a related table
How I'd do this in SQL would be;
Case if othertable.idSite in (0,1,5) then haulage_base else haluage END as CustomHaulageI've been successfully able to pull in the vaue of the idSite from the other table to a new custom column with
Site = RELATED(othertable[idSite])So, I thought I could us CASE as below to create my new column
CustomHaulage = (Case when RELATED(othertable[idSite] in (0,1,5) then haulage_base else haulage END)But I just get a column full of errors & "The syntax for 'Case' is incorrect. (DAX((Case when RELATED(AuctionsSage[idSIte] in (0,1,5) then haulage_base else haulage_auction END)))."
Solved! Go to Solution.
@donnellyk In DAX you use SWITCH statement instead of CASE
@donnellyk In DAX you use SWITCH statement instead of CASE
Thanks, got it working with a SWITCH
CustomHaulage = SWITCH(
TRUE (),
RELATED(OtherTable[idSIte])="0", thistable[haulage_base],
RELATED(OtherTable[idSIte])="1", thistable[haulage_base],
RELATED(OtherTable[idSIte])="5", thistable[haulage_base],
thistable[haulage_auction]
)
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 8 | |
| 7 |