Forum Discussion

sabd80's avatar
sabd80
Helper IV
2 years ago
Solved

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] )
 
  • Anonymous's avatar
    Anonymous
    2 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

     

     

     

10 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion
  • 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
  • ALLUREAN's avatar
    ALLUREAN
    Solution Sage
    Try this one:
    Testing Step 2 Cash Improvement = SUMX('Supplier Spend Analysis', 3000000 * [3.Step 2 DPO Days Move Each Supplier])
     
    • sabd80's avatar
      sabd80
      Helper IV

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

      • saudansari's avatar
        saudansari
        Helper II

        This should work - 

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

         

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    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])
    )



    • sabd80's avatar
      sabd80
      Helper IV

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