Forum Discussion
IF, FILTER SUM Function
- sjoshi7 years agoHelper II
Hello
Yes I have modified the mesure and column to get the account number from the dimension table as below but still the values is zero.
52500 = IF(HASONEVALUE('LedgerTable Dim'[Accountnum]),IF(VALUES('LedgerTable Dim'[Accountnum])="14850",CALCULATE(SUM('LedgerTrans Fact'[AmountMST]),'LedgerTable Dim'[Accountnum]="52500"),0),BLANK())
52500Col = IF(RELATED('LedgerTable Dim'[Accountnum])="14850",CALCULATE (
SUM ( 'LedgerTrans Fact'[AmountMST] ),
FILTER (ALL( 'LedgerTrans Fact'), RELATED('LedgerTable Dim'[Accountnum]) = "52500" )
),0)Thanks
Smita
- Ashish_Mathur7 years agoSuper User
Hi,
I am out of ideas now.
- sjoshi7 years agoHelper II
Hello
To explain more
In Account slicer we are selecting account number 14800. This Account slicer value is coming from Ledgertable dimension. LedgerTransFact.Accountnum (fact table) =Ledgertable.accountnum (Dimension table).
When the slicer value is 14800 then get the sum of amount from ledgertransfact table for account num 52000. I have tried below way also still it is giving zero value not sure what is incorrect
52500 = IF(HASONEVALUE('LedgerTable Dim'[Accountnum]),IF(VALUES('LedgerTable Dim'[Accountnum])="14850",CALCULATE(SUM('LedgerTrans Fact'[AmountMST]),'LedgerTrans Fact'[ACCOUNTNUM]="52500"),0),BLANK())
52500Col = IF(RELATED('LedgerTable Dim'[Accountnum])="14850",
CALCULATE (
SUM ( 'LedgerTrans Fact'[AmountMST] ),
FILTER (ALL( 'LedgerTrans Fact'), 'LedgerTrans Fact'[ACCOUNTNUM] = "52500" )
),0)- sjoshi7 years agoHelper II
Hello
After further analysis I saw that yes fact table account number and the dimension (Slicer Account) accountnum values are same for given record thats why sum is coming zero all the time in power BI but still I need to achieve that If statement. Is there any way to do that?
If LedgertableDimension.accountnum = "14850" then take sum amountmst for LedgertransFact.accountnum="52500" else null
Slicer: LedgertableDimension.accountnum
Thanks
Smita