Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Subracting measures and getting the wrong answer

I have created 2 measures that are working wonderfully.

 I now need to subtract one from the other so I created a third measure:
Hardware GP2 = 'Measures 1'[Hardware Sales] - 'Measures 1'[Hardware GP]
 
When I display the output I can see that the subtract isn't working and the calculated figure is incorrect..
Any one have any ideas what is happening here?
Thanks.
 
 
  • Anonymous's avatar
    Anonymous
    7 years ago

    I think I have found the problem. At some point through the calculations, the signage of one of the figures is being swapped. In the final measure both input values are shown as a negative (hence the incorrect value is being calculated vs the expected value), however pre input one of these values should be a positive.

    I will now step through the calculations to pin point exactly what is going on here.

     

    Many Thanks to you all for confirming that the DAX should work which ruled this out for me as a variable.

8 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous

    What is it that you are showing in the capture? A matrix visual?

    Can you share the pbix file?

    • Anonymous's avatar
      Anonymous
      Not applicable

      I know it isn't helpful but I can not share the PBX in this instance because of the data.

       

      Yes - It's an adulterated matrix view to show whats going on.

       

      I have validated both measures feeding this final subtration measure and to that point everything is correct.

      Both figures feeding in are correct, however the result is not.

      • AlB's avatar
        AlB
        Community Champion

        Anonymous

         

        What's the code for the other two measures? With this amount of info you leave us a bit in the dark.

        Maybe you can share a mock pbix with just dummy data but showing the issue?  I guess if this is not very time-consuming   

  • Hello Experts, i am calculating the difference between two columns based on row values. But the difference is slightly off. Column 1 is Sales actual and column 2 is Plan cost

     

    Sales Actual-Plan = [Sales Actual] - ['Year Plan'[Plan Cost]

     

    Sales Actual                Plan Cost                   Sales Actual - Plan Cost

    1,335,121                      3,947,194                  -2,611,985 wrong supposed to be -2,612,073

    1,692,710                       6,557,214                   -4,864,504. correct

    1,188,426                       3,154,451                     -1,966,013 wrong supposed to be -1,966,025

    .

    .

    .

    Total 

    33,144,323                       116,599,970                 -83,205,650 wrong supposed to -83,455,647

     

    Not sure what is going on here. Please any help will be greatly appreciated