Forum Discussion

nicknl's avatar
nicknl
Regular Visitor
7 years ago
Solved

calculate difference on two column values on visual Table

I have a Table visual on my dashboard:

 

And i would like to calculate the difference between amount(value from table X) and amount2(value from table Y), and add an extra column to the table visual(use a measure?), it would look like this:

 

How to do this?

I hope you guys can help me out :)

  • Hi nicknl ,

     

    To create a measure as below. If it doesn't meet your requirement, kindly share your sample data and excepted result to me. Please upload your files to One Drive and share the link here.

     

    difference = SUM(Table1[amount])-SUM(Table1[amount2])

     

    Please find the pbix as attached.

     

    Regards,

    Frank

7 Replies

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

    Hi nicknl ,

     

    To create a measure as below. If it doesn't meet your requirement, kindly share your sample data and excepted result to me. Please upload your files to One Drive and share the link here.

     

    difference = SUM(Table1[amount])-SUM(Table1[amount2])

     

    Please find the pbix as attached.

     

    Regards,

    Frank

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

      Hi nicknl ,

       

      Does that make sense? If so, kindly mark my answer as the solution to close the case please. Thanks in advance.

       

      Regards,
      Frank

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Yes, you would use a measure and add it to your table visual. In theory it might be something like:

     

    Measure = 
    VAR __sum1 = SUM('TableX'[amount])
    VAR __sum2 = SUM('TableY'[amount])
    RETURN
    __sum1 - sum2
    • nicknl's avatar
      nicknl
      Regular Visitor

      When I try this measure, it takes ages to load, any idea why?

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        OK, first question, does it work?

         

        After that, tough to say exactly, how many rows are we talking about?