Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
nicknl
Regular Visitor

calculate difference on two column values on visual Table

I have a Table visual on my dashboard:

 EEREE.png

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:

wF7rt.png

 

How to do this?

I hope you guys can help me out 🙂

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
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])

Capture.PNG

 

Please find the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

7 REPLIES 7
v-frfei-msft
Community Support
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])

Capture.PNG

 

Please find the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

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

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Greg_Deckler
Super User
Super User

OK, well then something is different between your data model and how it has been described, or at least the vision of it that I have in my head. So, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, take a look at Page 6, Tables 9 and 10 of attached.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

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

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

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

OK, first question, does it work?

 

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

unfortunately not, when I added the measure, it says: Can't display the visual.

Uhm, we are talking about an excel file with  around 30.000 rows, but I narrowed it down, but still taking a long time to load.

But I would like it to work first, before I am fixing the performance issue 😛

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.