The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 Historical]
)
where two other measures used in the one above are:
BS Act GC MnthEnd =
DIVIDE ( [BS Act LC], [BS Rate EOM] )
and
BS Act GC Historical =
CALCULATE (
SUMX (
BalanceSheet,
DIVIDE (
[BS Act LC],
IF (
ISBLANK (
LOOKUPVALUE (
'Exchange Rates'[Amount],
'Exchange Rates'[Month], BalanceSheet[Date],
'Exchange Rates'[Currency], BalanceSheet[BaseCurrency],
'Exchange Rates'[FX_Type], BalanceSheet[FxType]
)
),
1,
LOOKUPVALUE (
'Exchange Rates'[Amount],
'Exchange Rates'[Month], BalanceSheet[Date],
'Exchange Rates'[Currency], BalanceSheet[BaseCurrency],
'Exchange Rates'[FX_Type], BalanceSheet[FxType]
)
)
)
),
FILTER ( ALL ( 'Calendar' ), 'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) )
)
However, the total for the top measure (BS Act GC) doesn't add up correctly
I normally use summarize to fix similar issues but I can't figure out how to apply it correctly with SWITCH. Please help
Solved! Go to Solution.
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]
)
)
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]
)
)
Hi @Metricbits ,
Have you tried doing the a SUMX of the Class based on isinscope?
Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.
If the information is sensitive please share it trough private message.
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsUser | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
95 | |
51 | |
50 | |
46 |