Forum Discussion
Metricbits
5 years agoFrequent Visitor
Measure with switch - incorrect totals
Hi, I have the following measure: BS Act GC =
SWITCH (
VALUE ( CALCULATE ( MIN ( BalanceSheet[FxTypeNumber] ), ALL ( 'Calendar' ) ) ),
1, [BS Act GC MnthEnd],
2, [BS Act GC...
- 5 years ago
I solved the problem using this measure instead:
BS Act GC = VAR BalanceSheetVirt = ADDCOLUMNS ( CALCULATETABLE ( BalanceSheet, FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) ) ), "Rate Month End", LOOKUPVALUE ( 'Exchange Rates'[Amount], 'Exchange Rates'[Currency], BalanceSheet[BaseCurrency], 'Exchange Rates'[Month], MAX ( 'Calendar'[MonthStartDate] ), 'Exchange Rates'[FX_Type], "Month End" ), "Rate Historical", LOOKUPVALUE ( 'Exchange Rates'[Amount], 'Exchange Rates'[Currency], BalanceSheet[BaseCurrency], 'Exchange Rates'[Month], BalanceSheet[Date], 'Exchange Rates'[FX_Type], "Month End" ) ) RETURN SUMX ( BalanceSheetVirt, IF ( VALUE ( BalanceSheet[FxTypeNumber] ) = 1, [Amount_LC] / [Rate Month End], [Amount_LC] / [Rate Historical] ) )
Metricbits
5 years agoFrequent Visitor
I solved the problem using this measure instead:
BS Act GC =
VAR BalanceSheetVirt =
ADDCOLUMNS (
CALCULATETABLE (
BalanceSheet,
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
),
"Rate Month End",
LOOKUPVALUE (
'Exchange Rates'[Amount],
'Exchange Rates'[Currency], BalanceSheet[BaseCurrency],
'Exchange Rates'[Month], MAX ( 'Calendar'[MonthStartDate] ),
'Exchange Rates'[FX_Type], "Month End"
),
"Rate Historical",
LOOKUPVALUE (
'Exchange Rates'[Amount],
'Exchange Rates'[Currency], BalanceSheet[BaseCurrency],
'Exchange Rates'[Month], BalanceSheet[Date],
'Exchange Rates'[FX_Type], "Month End"
)
)
RETURN
SUMX (
BalanceSheetVirt,
IF (
VALUE ( BalanceSheet[FxTypeNumber] ) = 1,
[Amount_LC] / [Rate Month End],
[Amount_LC] / [Rate Historical]
)
)