Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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: 

 

CALCULATE( SUMX ('Cash 2021',[ACTIVITY-BB]),'Accounts'[Full Code] = "10400-0") +
     CALCULATE( SUMX ('Cash 2021',[ACTIVITY-BB]),'Accounts'[Full Code] = "11200-0") +
          CALCULATE( SUMX ('Cash 2021',[ACTIVITY-BB]),'Accounts'[Full Code] = "20100-0")
 
How can I write a sumifs to say that in the criteria ranges?  
 
If it was excel is was be =If( fund number is between 600-699, IF true = 10400+11220+20100, if false = account 32400
 
Thanks!
  • Anonymous's avatar
    Anonymous
    4 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

  • 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-msft's avatar
    v-cazheng-msft
    Community 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

     

    • Anonymous's avatar
      Anonymous
      Not 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

       

       

      • AlexisOlson's avatar
        AlexisOlson
        Super 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" }
                )
            )
        )
  • Anonymous's avatar
    Anonymous
    Not applicable

    v-cazheng-msft 

     

    I am currently playing with your solution will update you soon!