Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi community!
I'm trying to make a multi currency report, based on a slicer. I have a table with the currency rates by months:
On the other hand, I have a table with the currency and amout, wich I merge with the previous one, based on the month. Right there I have the columns calculiting each amount for the rate of that month.
Now, the issue is in the visuals, I can't get the totals:
This is the formula (pardon the little mess, I'm pointing the important things to look):
Solved! Go to Solution.
Ok, answering myself, the measure was almost correct (maybe not that elegant at all), this is the final version:
Hi @daniq ,
I think you can try code as below.
Dynamic Amount =
VAR ReportingCurrency =
SELECTEDVALUE ( 'Currency Rates'[Currency] )
VAR SourceCurrency =
SELECTEDVALUE ( 'Client Forecasting Delivery'[Currency] )
VAR Amount =
SUM ( 'Client Forecasting Delivery'[Forecast Amount with sign] )
VAR ARSRate =
AVERAGE ( 'Client Forecasting Delivery'[ARS RATE] )
VAR BRLRate =
AVERAGE ( 'Client Forecasting Delivery'[BRL RATE] )
VAR CLPRate =
AVERAGE ( 'Client Forecasting Delivery'[CLP RATE] )
VAR COPRate =
AVERAGE ( 'Client Forecasting Delivery'[COP Rate] )
VAR MXNRate =
AVERAGE ( 'Client Forecasting Delivery'[MXN RATE] )
VAR PENRate =
AVERAGE ( 'Client Forecasting Delivery'[PEN RATE] )
VAR USDRate =
AVERAGE ( 'Client Forecasting Delivery'[USD Rate] )
RETURN
SWITCH (
SourceCurrency,
"ARS",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"BRL",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"CLP",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"COP",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"MXN",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"PEN",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"USD",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
0
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ok, answering myself, the measure was almost correct (maybe not that elegant at all), this is the final version:
Hi @daniq ,
I think you can try code as below.
Dynamic Amount =
VAR ReportingCurrency =
SELECTEDVALUE ( 'Currency Rates'[Currency] )
VAR SourceCurrency =
SELECTEDVALUE ( 'Client Forecasting Delivery'[Currency] )
VAR Amount =
SUM ( 'Client Forecasting Delivery'[Forecast Amount with sign] )
VAR ARSRate =
AVERAGE ( 'Client Forecasting Delivery'[ARS RATE] )
VAR BRLRate =
AVERAGE ( 'Client Forecasting Delivery'[BRL RATE] )
VAR CLPRate =
AVERAGE ( 'Client Forecasting Delivery'[CLP RATE] )
VAR COPRate =
AVERAGE ( 'Client Forecasting Delivery'[COP Rate] )
VAR MXNRate =
AVERAGE ( 'Client Forecasting Delivery'[MXN RATE] )
VAR PENRate =
AVERAGE ( 'Client Forecasting Delivery'[PEN RATE] )
VAR USDRate =
AVERAGE ( 'Client Forecasting Delivery'[USD Rate] )
RETURN
SWITCH (
SourceCurrency,
"ARS",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"BRL",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"CLP",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"COP",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"MXN",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"PEN",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
"USD",
SWITCH (
ReportingCurrency,
"ARS", Amount * ARSRate,
"BRL", Amount * BRLRate,
"CLP", Amount * CLPRate,
"COP", Amount * COPRate,
"MXN", Amount * MXNRate,
"PEN", Amount * PENRate,
"USD", Amount * USDRate,
BLANK ()
),
0
)
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
25 | |
11 | |
8 | |
7 | |
6 |
User | Count |
---|---|
25 | |
13 | |
12 | |
10 | |
6 |