Hi, I have a problem using DAX/SWITCH.
My DAX is as below:
AR_JPY(Simul) = SWITCH(CALCULATE(MAX(‘Main’[Currency])),
“USD”,CALCULATE(SUM(‘Main’[AR]))*USD[USD の値],
CALCULATE(SUM(Main[AR_JPY])))
I’m using parameter for USD for currency exchange simulation purpose.
Only for USD, I use parameter but for other currency I want to keep original AR_JPY values.
And for “_Total”, I would like to calculate total amount properly.
The problem is I don’t know what to write for “_Total”.
If you could fill calculate_DAX below for me, I really appreciate it.
AR_JPY(Simul) = SWITCH(CALCULATE(MAX(‘Main’[Currency])),
“USD”,CALCULATE(SUM(‘Main’[AR]))*USD[USD の値],
“_Total”, (calculate_DAX) ,
CALCULATE(SUM(Main[AR_JPY])))
Regards,
I solved this issue by myself. I will share with you later. Thanks.
1 Like
Keith
May 26, 2024, 1:38am
3
Hi @dynazico ,
Can you please share your solution so other can also learn?
Did you try the Data Mentor to help with your solution?
thanks
Keith
For your reference:
homework.pbix (51.1 KB)
Keith
May 27, 2024, 8:29pm
5
thanks for solution…please mark your posting as solved.
thanks
Keith
HI,
I calculated AR_JPY(Simul) through two steps.
-1. AR_JPY_Converted
-2. Total_AR_Calculated
AR_JPY_Converted =
SWITCH(
CALCULATE(MAX(‘Main’[Currency])),
“USD”, CALCULATE(SUM(‘Main’[AR]))* USD[USD の値],
“_Total”, 0,
CALCULATE(SUM(‘Main’[AR_JPY]))
)
Total_AR_Calculated =
SUMX(
ALL(‘Main’[Currency]), // Remove filter to target all rows
[AR_JPY_Converted] // Calculate measures by each row
)
AR_JPY(Simul) =
VAR curr = CALCULATE(MAX(‘Main’[Currency]))
VAR amt = IF(curr = “_Total”, [Total_AR_Calculated], [AR_JPY_Converted])
RETURN amt
thanks,
Keith
May 28, 2024, 12:25am
7
thanks…i’m glad you solved it…Please make sure you marked you posting as solved
thanks