Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dangermouse
Frequent Visitor

Apply last exchange rate in a dynamically selected period across running total to date and sum

Hi all.

New to posting so apologies if I've done something incorrect.

 

I have exactly the same issue as @Morton041740 as shown in this post https://community.powerbi.com/t5/Desktop/Apply-last-exchange-rate-in-a-dynamically-selected-period-a...and have used the solution - which seems to work fine when the currency is shown however the grand total is using the maximum exchange rate (irrespective of currency)

 

Let's say I have a sales table with transaction dates, currency and amounts in that currency, e.g.

 

DateCcyAmount
03/01/2019CHF1000
11/03/2019CHF500
07/01/2019EUR250
07/02/2019EUR750
30/01/2019GBP1000
20/02/2019GBP300

 

I have a month end FX table converting to USD, thus (note, figures are made up!)

 

MthCcyFX to USD
Jan-19CHF0.9411
Feb-19CHF0.9751
Mar-19CHF0.9157
Jan-19GBP0.7072
Feb-19GBP0.7335
Mar-19GBP0.7408
Jan-19EUR0.8518
Feb-19EUR0.8652
Mar-19EUR0.8086

 

My model relates the month/year of the transaction to the monthly FX rate. I have a date table linked to the sales table.

 

I want the running total of the sales as at the month end, but revalued in USD at the current FX rate. So even where there has been no transaction in the month, the USD figure as at the end of March will be different to the one in February (say). This my total USD figure for March month end should be 

 

 running totalLatest FX (March)USD
GBP13000.74081,754.86
EUR10000.80861,236.71
CHF15000.91571,638.09
TOTAL USD  4,629.66

 

(In real life I'm trying to consolidate different currency bank transactions into one "closing balance" figure as at month end if this example is hard to imagine)

 

Have spent lots of hours on this, and I can feel I'm close - but the solution is eluding me

 

Thanks in advance 

 

 

 

2 ACCEPTED SOLUTIONS
V-lianl-msft
Community Support
Community Support

 
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

I knew I was close! I needed to change the model. 

 

I had this model

OldModel.PNG

 

 

but the link you provided suggested this model

 

NewModel.PNG

Once I had that, I built the following components 

 

FX Latest = 
VAR NormalFX =
    CALCULATE ( MAX ( tblFX[FX] ), RELATEDTABLE ( 'DateTable' ) )
RETURN
    CALCULATE (
        NormalFX,
        FILTER ( ALL ( FXDate ), FXDate[Mth] <= MAX ( DateTable[Date] ) )
    )

 

OCC Running Total = 
CALCULATE (
    SUM ( tblSales[Amount] ),
    FILTER ( ALL ( DateTable[Date] ), DateTable[Date] <= MAX ( DateTable[Date] ) )
)

 

USD Running Total Now =
SUMX ( 'Currency', DIVIDE ( [OCC Running Total], [FX Latest] ) )

 

and it works

Thanks @V-lianl-msft !

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

 
 
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I knew I was close! I needed to change the model. 

 

I had this model

OldModel.PNG

 

 

but the link you provided suggested this model

 

NewModel.PNG

Once I had that, I built the following components 

 

FX Latest = 
VAR NormalFX =
    CALCULATE ( MAX ( tblFX[FX] ), RELATEDTABLE ( 'DateTable' ) )
RETURN
    CALCULATE (
        NormalFX,
        FILTER ( ALL ( FXDate ), FXDate[Mth] <= MAX ( DateTable[Date] ) )
    )

 

OCC Running Total = 
CALCULATE (
    SUM ( tblSales[Amount] ),
    FILTER ( ALL ( DateTable[Date] ), DateTable[Date] <= MAX ( DateTable[Date] ) )
)

 

USD Running Total Now =
SUMX ( 'Currency', DIVIDE ( [OCC Running Total], [FX Latest] ) )

 

and it works

Thanks @V-lianl-msft !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.