Forum Discussion
SUMIF Help
Hello,
I am writing a formula to calculate fund balances for the beginning of the year from our accounting software. What I want is that for funds that are less then 600 or greater than 699 I want them to equal account code: "32400-0" but if they are in the 600s I want the following sum x formula:
- Anonymous4 years ago
Okay. so I am getting closer, but the issue is that that the test only is displaying 32400-0 and not the dollar amount of that actual account. I have tried putting a sumx infront of that 32400 but that is not working either
6 Replies
- AlexisOlsonSuper User
If those are your only two options, then an IF function is fine. If you had more, you'd probably want SWITCH ( TRUE, ... ).
IF ( [FundNumber] < 600 || [FundNumber] > 699, [Measure 32400], [Measure 10400 + 11220 + 20100] ) - v-cazheng-msftCommunity Support
Hi Anonymous
Not sure whether your issue has been resolved. Do some complements to the dax formula from Alexis here to make it more clear. This is a Measure formula.
Fund Balance =
IF (
SELECTEDVALUE ( 'TableName'[FundNumber] ) < 600
|| SELECTEDVALUE ( 'TableName'[FundNumber] ) > 699,
"32400-0",
CALCULATE (
SUMX ( 'Cash2021', [ACTIVITY-BB] ),
FILTER (
'Accounts',
'Accounts'[Full Code] = "10400-0"
|| Accounts[Full Code] = "11200-0"
|| Accounts[Full Code] = "20100-0"
)
)
)
If your "fund number" is a Measure got from calculation, just replace SELECTEDVALUE('TableName'[FundNumber]) with it. If your issue has been resolved by these formulas, could you please kindly mark the solution to help others find it more quickly? If you still have problems on it, please feel free to let us know. Thanks a lot!
Best Regards,
Community Support Team _ Caiyun
- AnonymousNot applicable
Okay. so I am getting closer, but the issue is that that the test only is displaying 32400-0 and not the dollar amount of that actual account. I have tried putting a sumx infront of that 32400 but that is not working either
- AlexisOlsonSuper User
I think this might be what you're looking for:
Fund Balance = IF ( SELECTEDVALUE ( 'TableName'[FundNumber] ) < 600 || SELECTEDVALUE ( 'TableName'[FundNumber] ) > 699, CALCULATE ( SUMX ( 'Cash2021', [ACTIVITY-BB] ), FILTER ( 'Accounts', 'Accounts'[Full Code] = "32400-0" ) ), CALCULATE ( SUMX ( 'Cash2021', [ACTIVITY-BB] ), FILTER ( 'Accounts', 'Accounts'[Full Code] IN { "10400-0", "11200-0", "20100-0" } ) ) )
- AnonymousNot applicable