AlwaysNeedExcelHelp
New Member
- Joined
- Sep 24, 2019
- Messages
- 6
Hey all,
I'm having some performance issues with Sumx that are causing very slow measure performance as was wondering if you smart people would know of a better way to accomplish these
TestMeasure=
'Take the slicer selection date'
VAR CalculationDate= [SelectedDate]
'Calculate USD values, no need to lookup anything
VAR CalcResult=
CALCULATE (
SUM ( Data[Amount] ),
FILTER ( VALUES ( Data[Currency] ), [Currency] = "USD" ),
FILTER (
VALUES ( Date[Due] ),
&& [Due] <= CalculationDate
))
'Perform NonUSD
+ CALCULATE (
SUMX (
'Data',
(
Data[Amount]
*
'find numerator of exchange rate
LOOKUPVALUE (
FXMarketRates[Multiplier],
FXMarketRates[FromTo], Data[Currency],
FXMarketRates[Eff Date], CalculationDate,
FXMarketRates[Rate Type], "CRRNT"
)
)
/
'find denom of exchange rate
LOOKUPVALUE (
FXMarketRates[Divisor],
FXMarketRates[FromTo], Data[Currency],
FXMarketRates[Eff Date], CalculationDate,
FXMarketRates[Rate Type], "CRRNT"
)
),
FILTER ( VALUES ( Data[Currency] ), [Currency] <> "USD" ),
FILTER (
VALUES ( Data[Due] ), [Due] <= CalculationDate
))
RETURN
IF ( ROUND ( CalcResult, 2 ) <> 0, ROUND ( CalcResult, 2 ) ) + 0
I'm having some performance issues with Sumx that are causing very slow measure performance as was wondering if you smart people would know of a better way to accomplish these
TestMeasure=
'Take the slicer selection date'
VAR CalculationDate= [SelectedDate]
'Calculate USD values, no need to lookup anything
VAR CalcResult=
CALCULATE (
SUM ( Data[Amount] ),
FILTER ( VALUES ( Data[Currency] ), [Currency] = "USD" ),
FILTER (
VALUES ( Date[Due] ),
&& [Due] <= CalculationDate
))
'Perform NonUSD
+ CALCULATE (
SUMX (
'Data',
(
Data[Amount]
*
'find numerator of exchange rate
LOOKUPVALUE (
FXMarketRates[Multiplier],
FXMarketRates[FromTo], Data[Currency],
FXMarketRates[Eff Date], CalculationDate,
FXMarketRates[Rate Type], "CRRNT"
)
)
/
'find denom of exchange rate
LOOKUPVALUE (
FXMarketRates[Divisor],
FXMarketRates[FromTo], Data[Currency],
FXMarketRates[Eff Date], CalculationDate,
FXMarketRates[Rate Type], "CRRNT"
)
),
FILTER ( VALUES ( Data[Currency] ), [Currency] <> "USD" ),
FILTER (
VALUES ( Data[Due] ), [Due] <= CalculationDate
))
RETURN
IF ( ROUND ( CalcResult, 2 ) <> 0, ROUND ( CalcResult, 2 ) ) + 0