Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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!
1 ACCEPTED SOLUTION
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

 

JMcAnarney_0-1636034245901.png

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

@v-cazheng-msft 

 

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

v-cazheng-msft
Community Support
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
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

 

JMcAnarney_0-1636034245901.png

 

Anonymous
Not applicable

Figured it out I did it the long way like this 

JMcAnarney_0-1636036543922.png

 

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" }
        )
    )
)
AlexisOlson
Super User
Super 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]
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.