Forum Discussion
IF, FILTER SUM Function
Hello
My teammate updated sample pbix is below ticket.
Thanks
Smita
Hello
If I write below measure its brings all the project numbers which not even related to this account and the list is more and we are looking for only project numbers which are associated
52505 =
IF (
MIN('LedgerTable Dim'[Accountnum]) = "14825",
CALCULATE (
SUM ( 'LedgerTrans Fact'[AMOUNTMST] ),
FILTER (
ALLEXCEPT (
'LedgerTrans Fact',
'Project Dim',
'Time Dim'
),
'LedgerTrans Fact'[ACCOUNTNUM] = "52505"
&& RELATED('Company Dim'[Company Number])= "999"
)
),
0
)
Only on value can be selected in Account slicer out of 9 values. Account slicer is restricted only for those 9 values. For those 9 values only one of the 9 output will be true.
EX If Account slicer is 14850 then get the sum of amountmst from fact for account 52500. First three columns(Current QTR, Prior QTR, Balance as of End of QTR) in the output are for account which is selected in slicer.
LedgerTable.ACCOUNTNUM.equals("14850")?"52500":
LedgerTable.ACCOUNTNUM.equals("14830")?"53100":
LedgerTable.ACCOUNTNUM.equals("14825")?"52505":
LedgerTable.ACCOUNTNUM.equals("14821")?"52201":
LedgerTable.ACCOUNTNUM.equals("14820")?"52100":
LedgerTable.ACCOUNTNUM.equals("14805")?"51500":
LedgerTable.ACCOUNTNUM.equals("14802")?"51201":
LedgerTable.ACCOUNTNUM.equals("14801")?"51200":
LedgerTable.ACCOUNTNUM.equals("14800")?"51100"
-- 52500
select sum(amountmst) from WH_LEDGERTRANS_F
where ACCOUNTNUM like '52500' and (DIMENSION4_PROJECT='30648' )
and DATAAREAID='999'
and TRANSDATE >='1/1/2017' and TRANSDATE <='3/31/2017'; -- 43434.48
--Current QTR for 14850
select sum(amountmst) from WH_LEDGERTRANS_F
where ACCOUNTNUM like '14850' and (DIMENSION4_PROJECT='30824' )
and DATAAREAID='999'
and TRANSDATE >='1/1/2017' and TRANSDATE <='3/31/2017'; -- negative 43434.48
--Prior QTR END for 14850
select sum(amountmst) from WH_LEDGERTRANS_F
where ACCOUNTNUM like '14850' and (DIMENSION4_PROJECT='30648') --30648
and DATAAREAID='999'
and TRANSDATE >='7/1/2017' and TRANSDATE <='12/31/2017';
Thanks
Smita