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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sabd80
Helper IV
Helper IV

DAX wrong total

Hi,

I have the measure (Testing Step 2 Cash Improvement ) that gives a wrong total, the total should be 684,507, but it is giving 691,141.

 

This the dax:

Testing Step 2 Cash Improvement =
sumx
(
    SUMMARIZE('Supplier Spend Analysis',  Supplier[Supplier Code Caption]),
    3000000 * [3.Step 2 DPO Days Move Each Supplier] )
 
2023-12-22_13-51-23.png
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @sabd80,

Here are some steps you can follow to troubleshoot the issue:

Here are my test data:

vheqmsft_0-1703580525668.png

1.Create a measure

Testing Step 2 Cash Improvement =
ROUNDUP (
    SUMX (
        SUMMARIZE (
            'Supplier Spend Analysis',
            'Supplier Spend Analysis (2)'[3.Step 2 DPO Days Move Each Supplier]
        ),
        3000000 * 'Supplier Spend Analysis (2)'[3.Step 2 DPO Days Move Each Supplier]
    ),
    0
)

2.Final output

vheqmsft_1-1703580603854.png

In order for you to solve the problem faster, you can refer to the following documentation

How to Get Your Question Answered Quickly - Microsoft Fabric Community

Best Regards,

Albert He

 

 

 

View solution in original post

10 REPLIES 10
sabd80
Helper IV
Helper IV

Hi All,

apologies for the late reply I was on leave.

None of the above are working.

The measure that gives the worng total relies on othe measures as in below screenshot:
2024-01-07_02-23-49.png

 

and below are the measures:

Total Spend (last 12 mth) =
CALCULATE( [Total Spend $],
FILTER (
ALL ( 'Calendar - Invoice Date'),
DATEDIFF (
'Calendar - Invoice Date'[Calendar Date],
TODAY (),
MONTH
) >= 1
&& DATEDIFF (
'Calendar - Invoice Date'[Calendar Date],
TODAY (),
MONTH
) <= 12
)
)
------------------------

Total Spend $ Yearly All Suppliers last 12 mths =
CALCULATE([Total Spend (last 12 mth)],ALLSELECTED(), ALL(Supplier))

the value= 773,041,452.71
-----------------------

1.Weighted Avg per Supplier last 12 mths =
DIVIDE([Total Spend (last 12 mth)], [Total Spend $ Yearly All Suppliers last 12 mths])
------------------------------------------

2.Step 2 Avg Days Payment Difference =
CALCULATE(
AVERAGE('Supplier Spend Analysis'[Step 2 Days Payment Difference]) ,
FILTER (
ALL ( 'Calendar - Invoice Date'[Calendar Date] ),
DATEDIFF (
'Calendar - Invoice Date'[Calendar Date],
TODAY (),
MONTH
) >= 1
&& DATEDIFF (
'Calendar - Invoice Date'[Calendar Date],
TODAY (),
MONTH
) <= 12
)
)
--------------------------------------

3.Step 2 DPO Days Move Each Supplier =
[1.Weighted Avg per Supplier last 12 mths] * [2.Step 2 Avg Days Payment Difference]
----------------------------------

4.Step 2 Cash Improvement =
3000000 * [3.Step 2 DPO Days Move Each Supplier]
-----------------------------------

Testing Step 2 Cash Improvement =
VAR NewTable=
SUMMARIZE('Supplier Spend Analysis', Supplier[Supplier Code Caption],"total",[4.Step 2 Cash Improvement])
RETURN
IF(HASONEVALUE(Supplier[Supplier Code Caption]),
[4.Step 2 Cash Improvement] ,SUMX(NewTable, [total])
)



also the data has been refreshed and it has different figures.

Anonymous
Not applicable

Hi  @sabd80,

Here are some steps you can follow to troubleshoot the issue:

Here are my test data:

vheqmsft_0-1703580525668.png

1.Create a measure

Testing Step 2 Cash Improvement =
ROUNDUP (
    SUMX (
        SUMMARIZE (
            'Supplier Spend Analysis',
            'Supplier Spend Analysis (2)'[3.Step 2 DPO Days Move Each Supplier]
        ),
        3000000 * 'Supplier Spend Analysis (2)'[3.Step 2 DPO Days Move Each Supplier]
    ),
    0
)

2.Final output

vheqmsft_1-1703580603854.png

In order for you to solve the problem faster, you can refer to the following documentation

How to Get Your Question Answered Quickly - Microsoft Fabric Community

Best Regards,

Albert He

 

 

 

Greg_Deckler
Community Champion
Community Champion

@sabd80 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



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
bhanu_gautam
Super User
Super User

@Greg_Deckler , your favourite topic 😃




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






ALLUREAN
Solution Sage
Solution Sage

Try this one:
Testing Step 2 Cash Improvement = SUMX('Supplier Spend Analysis', 3000000 * [3.Step 2 DPO Days Move Each Supplier])
 
2023-12-22_07-27-15.png



Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




that did not work, the supplier code should be the same.

This should work - 

TCI = SUMX('Table (2)', 3000000 * 'Table (2)'[DPO])

saudansari_0-1703263464760.png

 

saudansari_1-1703263473040.png

 

@sabd80  If the DAX worked for you please accept it as a solution. 

ryan_mayu
Super User
Super User

maybe you can try 

sumx
(
   'Supplier Spend Analysis'
    3000000 * [3.Step 2 DPO Days Move Each Supplier] )
 
if it's still not correct, pls provide the sample data and expected output




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.