Forum Discussion
DAX currency translation
Hi,
I would be really greatful is someone could assist. I'm very new to power BI and after searching a lot I'm still struggling for a solution here that suits my setup.
My data is all in one currency & I want to convert it into different versions of dollar rates. The DAX query i pulled together worked okish when I had the same rate for each period (I dont have dates in the data, just numbered financial periods 1 to 12).
However some of my currency scenarios have a different rate per period and they pull in blank, so I need help changing this query to take into account the rates at different periods.
The second issue is in my value column I'm converting there is also volume that I do no want to convert and keep at the same value, this pulls from my P&L column in the data sheet
Current DAX formula:
Currency sheet:
Also including relationships if this helps - the Period reference is what links them
Thanks for any assistance
- Anonymous4 years ago
ok i duplicated the values so i can have a similar scenario:
im still not sure if i understood correctly but here is my new table i sampled randome data numbers:as you see i have multiple gross profit on period 9 or 12 or whatever:
sum of values = CALCULATE(SUM(Daatasheet[Value]),ALL(Daatasheet[Value]))
now use the same formula but use:Correct amount = IF(FIRSTNONBLANK(Daatasheet[P&L],1)<>"Volume",SUMX('Currency','Currency'[Currency rate] *[valueis]),SUM(Daatasheet[Value]))
23 Replies
- AnonymousNot applicable
Hello Glen_
Can you please provide some data sample and an example where it went wrong
- Glen_Regular Visitor
Hi Anonymous
No problem, I've added a sample of the data below
Also - screenshot of the results (from a more complete set):
Volume figures are having fx changes applied- need these to stay the same as they are not impacted by currency rates, GBP vols are correct as a rate of 1 is being applied.
Only 3 currencies are pulling in (the ones that have exactly the same rate each period). "$ - PY" & "$ - F93" are not and they vary by period
DATASHEETS:
BU Scenario PERIOD SKU CODE Customer P&L Value BCS UK Final Plan 2022 12 5000001356 DISCOUNTERS Gross Profit 3024.5126 BCS UK Final Plan 2022 12 5000001356 DISCOUNTERS Net Sales 4660 BCS UK Final Plan 2022 12 5000001356 DISCOUNTERS Gross Sales 4660 BCS UK Final Plan 2022 12 5000001356 DISCOUNTERS Volume 2000 BCS UK Final Plan 2022 11 5000001356 DISCOUNTERS Gross Profit 3024.5126 BCS UK Final Plan 2022 11 5000001356 DISCOUNTERS Net Sales 4660 BCS UK Final Plan 2022 11 5000001356 DISCOUNTERS Gross Sales 4660 BCS UK Final Plan 2022 11 5000001356 DISCOUNTERS Volume 2000 BCS UK Final Plan 2022 10 5000001356 DISCOUNTERS Gross Profit 3024.5126 BCS UK Final Plan 2022 10 5000001356 DISCOUNTERS Net Sales 4660 BCS UK Final Plan 2022 10 5000001356 DISCOUNTERS Gross Sales 4660 BCS UK Final Plan 2022 10 5000001356 DISCOUNTERS Volume 2000 BCS UK Final Plan 2022 9 5000001356 DISCOUNTERS Gross Profit 3024.5126 BCS UK Final Plan 2022 9 5000001356 DISCOUNTERS Net Sales 4660 BCS UK Final Plan 2022 9 5000001356 DISCOUNTERS Gross Sales 4660 BCS UK Final Plan 2022 9 5000001356 DISCOUNTERS Volume 2000 BCS UK Final Plan 2022 8 5000001356 DISCOUNTERS Gross Profit 3024.5126 Currency:
Period Currency Currency rate 1 GBP 1 2 GBP 1 3 GBP 1 4 GBP 1 5 GBP 1 6 GBP 1 7 GBP 1 8 GBP 1 9 GBP 1 10 GBP 1 11 GBP 1 12 GBP 1 1 $ - P22 1.38889 2 $ - P22 1.38889 3 $ - P22 1.38889 4 $ - P22 1.38889 5 $ - P22 1.38889 6 $ - P22 1.38889 7 $ - P22 1.38889 8 $ - P22 1.38889 9 $ - P22 1.38889 10 $ - P22 1.38889 11 $ - P22 1.38889 12 $ - P22 1.38889 1 $ - F93 1.35583 2 $ - F93 1.34944 3 $ - F93 1.3132 4 $ - F93 1.28341 5 $ - F93 1.24614 6 $ - F93 1.22784 7 $ - F93 1.20292 8 $ - F93 1.18881 9 $ - F93 1.13036 10 $ - F93 1.137829991 11 $ - F93 1.137829991 12 $ - F93 1.137829991 1 $ - P23 1.137829991 2 $ - P23 1.137829991 3 $ - P23 1.137829991 4 $ - P23 1.137829991 5 $ - P23 1.137829991 6 $ - P23 1.137829991 7 $ - P23 1.137829991 8 $ - P23 1.137829991 9 $ - P23 1.137829991 10 $ - P23 1.137829991 11 $ - P23 1.137829991 12 $ - P23 1.137829991 1 $ - PY 1.36521 2 $ - PY 1.3929 3 $ - PY 1.38469 4 $ - PY 1.38592 5 $ - PY 1.41457 6 $ - PY 1.39748 7 $ - PY 1.38329 8 $ - PY 1.37772 9 $ - PY 1.37094 10 $ - PY 1.36657 11 $ - PY 1.33914 12 $ - PY 1.33169 Thanks again
- AnonymousNot applicable
hello thank you for providing me the details
im not sure i understood you correctly but is this the result you want?Correct amount = IF(SELECTEDVALUE(Daatasheet[P&L]) <>"Volume",SUMX('Currency','Currency'[Currency rate] * CALCULATE(VALUES(Daatasheet[Value]))),SUM(Daatasheet[Value]))
- tamerj1
Community Champion
Hi Glen_
Kindly refer to attached file with the proposed solution. I hope this is what you're looking for.Amount = VAR CurrentPL = SELECTEDVALUE ( 'P L Dimension'[P&L] ) VAR VolumeAmount = SUM ( DATASHEETS[Value] ) VAR NormalAmount = SUMX ( 'Currency', VAR CurrentRate = 'Currency'[Currency rate] VAR CurrentAmount = CALCULATE ( SUM ( DATASHEETS[Value] ), CROSSFILTER ( 'Currency'[Period], 'Time Dimension'[Period], BOTH ) ) RETURN CurrentAmount * CurrentRate ) RETURN IF ( CurrentPL = "Volume", VolumeAmount, NormalAmount )