Forum Discussion

yaman123's avatar
yaman123
Post Partisan
5 years ago

Subtraction not correct

Hi, 

 

I am creating a simple measure to subtract DED_TOTAL - SUBTOTAL but the value is not correct when i do this manually. I also tried creating a column but still the same issue. I tried a quick measure and still the incorrect values. 

 

E.g first row should show a value of 268.9 but it is showing as -301783.61

Any help is appreciated!

 

Thanks

 

Yasir

8 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello yaman123 ,

     

    Could you provide more information to understand the scenrio

    1)  DED_TOTAL , SUBTOTAL are the default columns of table or calculated column/Measure?

    2) Are you using any Slicer/Filter

    • yaman123's avatar
      yaman123
      Post Partisan

      Hi Anonymous 

       

      SUBTOTAL is a column from a database table. 

       

      DED_TOTAL is a column i created on Power BI to sum other columns. 

       

      I am using a slicer to show a month period.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello yaman123 ,

     

    Please try with measure

    Measure = CALCULATE(MAX(Table[DED_TOTAL])-MAX(Table[SUBTOTAL]),ALLSELECTED(Table[Date])
    )

     

    If this doesn't find the solution of your problem, please share pbix file 

    • yaman123's avatar
      yaman123
      Post Partisan

      Hi ,

       

      That did not work. It is still giving the incorrect figure. 

       

      The slice is a period so the format is year monthno ie 202102 for feb 2021. this is a column in the database table 

  • v-lionel-msft's avatar
    v-lionel-msft
    Community Support

    Hi yaman123 ,

     

    Please try this formula.

    Measure =
    SUM([DED_TOTAL] ) - SUM([SUBTOTAL] )

     

    Best regards,
    Lionel Chen

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

    • yaman123's avatar
      yaman123
      Post Partisan

      Hi v-lionel-msft 

       

      The measure is still giving the incorrect value. 

       

      The DED_TOTAL column is adding 10 columns together e.g column a + column b+ column c etc and this gives me the correct value per member per period. But when i subtract this from the SUBTOTAL column which is a column from the database table, it gives an incorrect value. 

      • v-lionel-msft's avatar
        v-lionel-msft
        Community Support

        Hi yaman123 ,

         

        So DED_TOTAL is a measure and SUBTOTAL is a column?

        Please try this.

        SUMX( Table, [DED_TOTAL] ) - SUM([SUBTOTAL])

         

        Best regards,
        Lionel Chen

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