Hi There,
I created a measure(Last Year BAL) to loop through the variables I have defined, where the value exists it should calculate the value (LY) - Defined as another measure;
Last Year Bal =
VAR DemandDeposits = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Demand Deposits”))
VAR Collections = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Collections/Remittances”))
VAR Bal = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Balances with Other Banks”))
VAR SavingsDeposits = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Savings Deposits”))
VAR EP = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Electronic Purse”))
VAR ShortDeposits = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Short Deposits”))
VAR DemandDom = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Demand Domiciliary”))
VAR TermDeposit = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Term Deposits”))
VAR FixedDom = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Fixed Domiciliary”))
VAR ConsumerFinance = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Demand Deposits”))
VAR RetailFinance = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Retail Finance”))
VAR Overdrafts = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Overdrafts”))
VAR TenoredLoans = CALCULATE([LY], FILTER(BS_Updated,BS_Updated[CAPTION]=“Tenored Loans”))
Return
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Demand Deposits”,DemandDeposits,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Collections_Remittances”,Collections,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Balances with Other Banks”,Bal,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Savings Deposits”,SavingsDeposits,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Electronic Purse”,EP,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Term Deposits”,TermDeposit,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Short Deposits”,ShortDeposits,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Demand Domiciliary”,DemandDom,
IF(SELECTEDVALUE(BS_Updated[CAPTION])=“Fixed Domiciliary”,FixedDom,
20 )))))))))
Where it False it should Output 20.
Then I went ahead to define the master measure( LY_Bal’000) which brings in all values (both subtotals and others.
LY Bal ('000) =
VAR Current_Item = SELECTEDVALUE(Template[Balance Sheet Normalized])
RETURN
SWITCH(TRUE(),
Current_Item = “Current”, DIVIDE([Current],1000,0),
Current_Item = “Savings”, DIVIDE([Savings],1000,0),
Current_Item = “LCY CASA”, DIVIDE([LCY CASA],1000,0),
Current_Item = “LCY FIXED DEPOSIT”, DIVIDE([LCY FIXED DEPOSIT],1000,0),
Current_Item = “Time Deposits”, DIVIDE([Time Deposit],1000,0),
Current_Item = “LCY DEPOSIT”, DIVIDE([LY_LCY DEPOSIT],1000,0),
Current_Item = “FCY DEPOSIT”, DIVIDE([LY_FCY DEPOSIT],1000,0),
Current_Item = “Total Customer Deposits”, DIVIDE([Total Customer Deposits],1000,0),
CALCULATE(‘Last Year Measures’[Last Year Bal], FILTER(‘Template’,Template[Balance Sheet (Average) For ]= Current_Item)
))
The Problem now is asides from sub totals, other values return 20.
Output:
Please I need to know what is wrong, there is no synthax error in the dax formulas