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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Lodan
Helper II
Helper II

Using exchange rates

Hello,

 

Today I have a visual that calculated the sum of the total MRR as long as the start date is before and the end date is after.  It is linked to the dates table so it does is on a monthly basis.  I then lists this in a table for each month and a separate one with it rolled up to the year (PBIX is attached).

 

It works well but I would like tov take it to the next level.  Instead of sum'ing the MRR based on the ($) column (which was a one time conversion at start date) I would like it to account for currency changes month to month.

 

The table has a currency column and the value in that currency.  I have also added an exchange rates table.

 

Effectively what I want to change it to is if the currency field has a value to then multiply it by the exchange rate for that currency and for that month and if the currency column doesn't have a value to tahe the ($) amount and then sum them up on as monthly basis.

 

Not entirely sure I am making sense.  Let me know if not please.  I am trying to work out the best way of achieving this and am struggling.  Any help would be appreciated please.

 

Test.pbix

 

Thanks and regards

2 ACCEPTED SOLUTIONS
johnt75
Super User
Super User

You need to make a couple of changes in your model. First, change the type of the [MRR] column to a decimal number. Also link 'Date'[Date] to 'Exchange Rates'[Time Period]. Then you can create a measure like

MRR Revenue Converted = 
VAR BaseTable = SUMMARIZE( 'Exchange Rates', 'Dates2'[Month Year], 'Exchange Rates'[Source], 'Exchange Rates'[Rate] )
VAR ConvertedValue = SUMX(
	BaseTable,
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Source = 'Exchange Rates'[Source]
	VAR Result = CALCULATE(
		SUM( TblCombinedx[MRR] ),
		TblCombinedx[Calculated End Date] > MaxDate,
        TblCombinedx[(estimated) (billing) start date] <= MaxDate,
        TblCombinedx[PON/Other] IN { "PON", "Excluded" },
		TblCombinedx[Currency] = Source
	) * 'Exchange Rates'[Rate]
	RETURN Result
)
VAR UnconvertedValue = SUMX( VALUES( Dates2[Month Year] ),
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Result = CALCULATE(
		SUM( TblCombinedx[MRR] ),
		TblCombinedx[Calculated End Date] > MaxDate,
        TblCombinedx[(estimated) (billing) start date] <= MaxDate,
        TblCombinedx[PON/Other] IN { "PON", "Excluded" },
		ISBLANK( TblCombinedx[Currency] )
	)
	RETURN Result
)
VAR Result = ConvertedValue + UnconvertedValue
RETURN Result

View solution in original post

The line

TblCombinedx[Currency] = Source

makes sure that it is the correct currency.

View solution in original post

6 REPLIES 6
johnt75
Super User
Super User

You need to make a couple of changes in your model. First, change the type of the [MRR] column to a decimal number. Also link 'Date'[Date] to 'Exchange Rates'[Time Period]. Then you can create a measure like

MRR Revenue Converted = 
VAR BaseTable = SUMMARIZE( 'Exchange Rates', 'Dates2'[Month Year], 'Exchange Rates'[Source], 'Exchange Rates'[Rate] )
VAR ConvertedValue = SUMX(
	BaseTable,
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Source = 'Exchange Rates'[Source]
	VAR Result = CALCULATE(
		SUM( TblCombinedx[MRR] ),
		TblCombinedx[Calculated End Date] > MaxDate,
        TblCombinedx[(estimated) (billing) start date] <= MaxDate,
        TblCombinedx[PON/Other] IN { "PON", "Excluded" },
		TblCombinedx[Currency] = Source
	) * 'Exchange Rates'[Rate]
	RETURN Result
)
VAR UnconvertedValue = SUMX( VALUES( Dates2[Month Year] ),
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Result = CALCULATE(
		SUM( TblCombinedx[MRR] ),
		TblCombinedx[Calculated End Date] > MaxDate,
        TblCombinedx[(estimated) (billing) start date] <= MaxDate,
        TblCombinedx[PON/Other] IN { "PON", "Excluded" },
		ISBLANK( TblCombinedx[Currency] )
	)
	RETURN Result
)
VAR Result = ConvertedValue + UnconvertedValue
RETURN Result

Thanks very much.  I think that gets me most of my way there.

 

Annoyingly that looks better in the test file than in my live file.  I will try to cut the love one down enough to share that later.  

 

For this part.  If I understand correctly, it create a new summary table with 'month year', Currency and rate in it.  There are two currencies and rates for each month.

 

We then effectively filter the sumx calculation by whether the currency in 'tblcombined' is in 'Exchange Rates' thus effectively filtering down the USD ones which we handle in the second part.

 

Then we multiple that sum by the exchange rate.  Does it know at this point which exchange rate please?

We don't have a relationship connecting the two currencies so I was wondering how did it know to match EUR in 'tblcombined' to EUR in 'Exchange rates' to thus pick the (for example) January 2024 EUR rate and not the January 24 GBP rate.

 

VAR BaseTable = SUMMARIZE( 'Exchange Rates', 'Dates2'[Month Year], 'Exchange Rates'[Source], 'Exchange Rates'[Rate] )
VAR ConvertedValue = SUMX(
	BaseTable,
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Source = 'Exchange Rates'[Source]
	VAR Result = CALCULATE(
		SUM( TblCombinedx[MRR] ),
		TblCombinedx[Calculated End Date] > MaxDate,
        TblCombinedx[(estimated) (billing) start date] <= MaxDate,
        TblCombinedx[PON/Other] IN { "PON", "Excluded" },
		TblCombinedx[Currency] = Source
	) * 'Exchange Rates'[Rate]
	RETURN Result

 

There is obviously also the possibility that I am off my rocker and it is correct its just that the exchange rates went down since it was first billed.  I will pick one of the months and do an excel equation to check that too.

 

Regards

The line

TblCombinedx[Currency] = Source

makes sure that it is the correct currency.

Thanks very much.  I have a follow up question if I may.

 

I want to try to minimise the number of measures I have that do a similiar thing.

There are three types of visuals I am trying to do with this data:

1) Revenue trend over time - This nails that

2) focus on a particular month - I can use the same measure with the month selected from dates2 as a visual filter.

3) Difference between two months - This has me stuck.

 

Effectively I need to create a measure that filters  the measure 'MRR Revenue Converted' by a month (say december) and then subtract from that 'MRR Revenue Converted' that is filtered by a different month (say november).

 

Is that possible please?

Or do I need to add measure filtered on december and on November first?

Ignore this please.  I was waaay over thinking it and not looking at the obvious (and simple) way.

I think i have sorted it, although it might not be in the best / easiest manner.

 

I duplicated the exhcnage rate table and then made it so I had GBP in one (called GBP) and EUR in the other (called EUR).  Then I did this and the values look better:

 

MRR Revenue Converted2 = 
VAR BaseTable = SUMMARIZE( 'GBP', 'Dates2'[Month Year], 'GBP'[Source], 'GBP'[Rate] )
VAR ConvertedValueGBP = SUMX(
	BaseTable,
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Source = 'GBP'[Source]
	VAR Result = CALCULATE(
		SUM( TblCombined[MRR] ),
		TblCombined[Calculated End Date] > MaxDate,
        TblCombined[(estimated) (billing) start date] <= MaxDate,
        TblCombined[PON/Other] IN { "PON", "Excluded" },
		TblCombined[Currency] = Source
	) * 'GBP'[Rate]
	RETURN Result
)
VAR BaseTable2 = SUMMARIZE( 'EUR', 'Dates2'[Month Year], 'EUR'[Source], 'EUR'[Rate] )
VAR ConvertedValueEUR = SUMX(
	BaseTable2,
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Source = 'EUR'[Source]
	VAR Result = CALCULATE(
		SUM( TblCombined[MRR] ),
		TblCombined[Calculated End Date] > MaxDate,
        TblCombined[(estimated) (billing) start date] <= MaxDate,
        TblCombined[PON/Other] IN { "PON", "Excluded" },
		TblCombined[Currency] = Source
	) * 'EUR'[Rate]
	RETURN Result
)
VAR UnconvertedValue = SUMX( VALUES( Dates2[Month Year] ),
	VAR MaxDate = CALCULATE( MAX( 'Dates2'[Date] ) )
	VAR Result = CALCULATE(
		SUM( TblCombined[MRR ($)] ),
		TblCombined[Calculated End Date] > MaxDate,
        TblCombined[(estimated) (billing) start date] <= MaxDate,
        TblCombined[PON/Other] IN { "PON", "Excluded" },
		ISBLANK( TblCombined[Currency] )
	)
	RETURN Result
)
VAR Result = ConvertedValueGBP + UnconvertedValue + ConvertedValueEUR
RETURN Result

Any improvement suggestions would be welcomed.  Thanks very much for all your help!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.