Forum Discussion

Unknown1996's avatar
Unknown1996
Regular Visitor
3 years ago
Solved

Wrong totals while calculating percentages

While calculating the percentage I’m getting wrong totals and I’m using the following code for it (

Asset Suite2851orders = VAR A=CALCULATE (SUM('SFDC Won 2851(orders) ' [Total Sales Price (converted)]),FILTER('SFDC Won

ro

2851 (orders)', 'SFDC Won 2851(orders)' [New Product line Assignement] IN {"Asset Suite"}))

VAR B

= DIVIDE (CALCULATE (SUM('SFDC Won 2851(orders) ' [Total Sales Price (converted) 1), FILTER('SFDC Won 2851(orders) ',

'SFDC Won 2851(orders) ' [New Product line Assignement] IN {"Asset Suite"})), [Orders2851_PL(total)_Without_Notallocated], 0)

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Unknown1996 ,

     

    This is due to CALCULATE triggers context transition. I think this article gives a good explanation of it.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

11 Replies

  • Unknown1996 
    I think you should provide bit better description while asking for help from all these guys.
    Insert your DAX in a readable matter, not plain text.
    What is your "wrong" total and what result do you expect?

  • Unknown1996's avatar
    Unknown1996
    Regular Visitor

    Wrong total is 0.26 in third column, expected total is 1.47 is total of all the above values in the column and the formatted DAX is 

    =

    DIVIDE

    CALCULATE

    SUM

    'SFDC Won

    2851(orders)' [Total Sales Price (converted)] ),

    FILTER (

    'SFDC Won

    'SFDC Won

    IN

    {

    2851 (orders)'

    2851(orders)'[New Product line Assignement]

    "Asset Performance

    Management"

    }

    CALCULATE

    SUM

    *SFDC Won 2851(orders)' [Total Sales Price (converted)] ),

    FILTER

    'SFDC Won

    'SFDC Won

    2851 (orders)'

    2851(orders)' [New Product line Assignement]

    IN {

    "Asset Performance Management"

    "Ellipse"

    "LinkOne"

    "Axis"

    "Service Suite"

    "eSOMS"

    "Lumada (EAM & FSM)"

    "Asset Suite"

    }),0)

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Unknown1996 ,

     

    You can create a new measure to be placed on the visual object instead of the old one.

    NewMeasure = SUMX(VALUES(Table[Column]), [YourCurrentMeasure])
    

     

    Use you table and column name used on the rows in your visual, but this will give you the correct results in both your rows and "Total".

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

     

    • Unknown1996's avatar
      Unknown1996
      Regular Visitor

      Tried but not getting correct values,can you exactly tell me where to place your dax and rewrite it ?

    • Unknown1996's avatar
      Unknown1996
      Regular Visitor

       

      Got the total as correct value now excellent but when I’m using it in the variable inside another dax formula again it’s showing wrong total can you help me with that 

    • Unknown1996's avatar
      Unknown1996
      Regular Visitor

      If I create a new measure and like you mentioned and use it means I’m getting the correct totals but when I put your measure inside a VAR and used in the dax means it’s giving me wrong total again but both the formulas are same why they are working different 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Unknown1996 ,

         

        This is due to CALCULATE triggers context transition. I think this article gives a good explanation of it.

         

        Best Regards,

        Neeko Tang

        If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.