Forum Discussion

katietran0467's avatar
2 years ago

Simple subtraction is wrong in Measure

I have 2 tables with quantity columns. I created a measure to subtract between 2 columns with the DAX below.

 

Measure = sum(Table1[Quantity]) - sum(Table2[Quantity])

 

It is very simple measure but still has the wrong result in some lines without reason. As you can see in the below screenshot, all lines are correct except 2 lines. I tried to extend the decimal of those columns but the data in Table 1 and Table 2 is the same, no decimals. Any reasons for the problem? Thanks in advance.

 

 

4 Replies

  • katietran0467 in the screenshot you have a sum of quantity and open bc and then var, but the problem statement is different than what you showed in the screenshot, could you provide the details that reflect what is in the screenshot.

    • katietran0467's avatar
      katietran0467
      Helper I

      Hi parry2k , Var = sum(column 2) - sum(column 1). The column's names may be confused but the same concept. You could see all lines correct except 2 lines I highlighted.

  • katietran0467 it becomes a bit easier not to ask an unnecessary question if everything aligns in the post. Think from the perspective of someone who is reading the post and trying to connect the dots.

     

    Anyhow, what is the data type of column1 and column 2 in PQ? 

    • katietran0467's avatar
      katietran0467
      Helper I

      Hi parry2k 

      I explained the situation and had the screenshot and highlighted the problem in the ss as well. Also, I extended the number of decimals for all columns to find the differences but no clue.

       

      In PQ, the quantity columns in Table 1 and Table 2 are decimal format.