Forum Discussion
DAX wrong total
- Anonymous2 years ago
Hi sabd80,
Here are some steps you can follow to troubleshoot the issue:
Here are my test data:
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
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
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:
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.