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
Yrstruly2021
Helper V
Helper V

SUM/SUMIF Function In DAX

Please assist. Am i using the correct function in dax for SUM/SUMIF equilvalents in Dax, Also when do i use Calculate?

My Totals are inflated, my conversions from Excel to DAX, might not be correct.

Measure: Depreciation and amortisation in Excel(see Excel link for Formula), DAX:

WorkingCapitalMvtsInclProvisions = 
[Other asset movements] 
+ [Working capital - budget flex]
+ CALCULATE(
    SUM('ZTBR'[Amount in USD]),
    'ZTBR'[Roll_Up_Function] = "Provision movements"
)<p>Formula in Excel: <li-code lang="markup">=-SUMIF(Details!B:B;'Cash Flow'!G39;Details!G:G)

 

 

AND Disposals & impairment of fixed assets.

DAX: 

 

Disposals & impairment of fixed assets = 
CALCULATE(
    SUM('ZTBR'[Amount in USD]),
    'ZTBR'[Roll_Up_Function] IN {
        "Profit on disposal of pooling equipment",
        "Scrapped pooling equipment",
        "Impairment or valuation adjustment of pooling equipment",
        "Disposals or valuation adjustments of other fixed assets"
    }
)

 

 

Excel Formula: 

 

=SUM(K21:K24)

 

 

 

 

 

 

 

PBIX: https://drive.google.com/file/d/1-wHE0e50nSM9-wSq4dTxStDX58APO_MI/view?usp=sharing  

Excel: https://docs.google.com/spreadsheets/d/1ubo9TAz2zzCpKbfO5SFBMjFLgjFtUxhY/edit?usp=sharing&ouid=10412...

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Yrstruly2021 Several different issues here. Generally use would use something like SUMX(FILTER(...), ...) for SUMIF. See Excel to DAX Translation here: S Excel to DAX Translation - Microsoft Fabric Community

 

For totals, First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e

This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907

Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Both of the solutions you provided for SUMIF gives the same data/value output.

 

WorkingCapitalMvtsInclProvisions = 
[Other asset movements] 
+ [Working capital - budget flex]
+ CALCULATE(
    SUM('ZTBR'[Amount in USD]),
    FILTER(
        ALL('ZTBR'),
        'ZTBR'[Roll_Up_Function] = "Provision movements"
    )
)
AND

WorkingCapitalMvtsInclProvisions = 
[Other asset movements] 
+ [Working capital - budget flex]
+ SUMX(
    FILTER(
        'ZTBR',
        'ZTBR'[Roll_Up_Function] = "Provision movements"
    ),
    'ZTBR'[Amount in USD]
)

AND 

WorkingCapitalMvtsInclProvisions = 
[Other asset movements] 
+ [Working capital - budget flex]
+ CALCULATE(
    SUM('ZTBR'[Amount in USD]),
    'ZTBR'[Roll_Up_Function] = "Provision movements"
)

So most of my calculations are wrong so far, leaving me with inflated figures. Cash Flow Imbalance should be 0. Can you check thepbix file if you get 0 after correct calculations has been applied?

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.

Top Solution Authors