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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
kdeff6006
Frequent Visitor

Need to compare 2 columns that come from different tables

I need to find the difference between 2 columns in a table, and the 2 columns come from different tables. 

 

Help.png

 

As you can see the table is comparing sales reps' total bookings vs what they're quotas were per quarter. Then at then end there is a total column. I would like to add a column for each quarter that does Bookings - Quotas to show the difference between the two. Bookings comes from it's own table and Quotas comes from another. Is this possible to do? If I cannot do it by quarter can I take the difference of Booking - Quotas in the totals column at the end?

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@kdeff6006

If your tables are in a relationship as below, you can just create a measure as

difference = SUM(bookings[Booking])-SUM(quota[Quota])

Capture.PNG

 

Capture.PNG

 

See attached demo.

 

 

 

View solution in original post

9 REPLIES 9
Eric_Zhang
Microsoft Employee
Microsoft Employee

@kdeff6006

If your tables are in a relationship as below, you can just create a measure as

difference = SUM(bookings[Booking])-SUM(quota[Quota])

Capture.PNG

 

Capture.PNG

 

See attached demo.

 

 

 

@Eric_Zhang Thank you for your response. Doing the calculated measure worked. However, when I add the "Difference" measue to my visualization, I lose some filters that I had applied and I see more data than I would like to. Have you ever seen this issue?


@kdeff6006 wrote:

@Eric_Zhang Thank you for your response. Doing the calculated measure worked. However, when I add the "Difference" measue to my visualization, I lose some filters that I had applied and I see more data than I would like to. Have you ever seen this issue?


@kdeff6006

What are the filters? Could you post a sample pbix file? You can upload it to Onedrive or any web storage and share the link. Do mask sensitive data before uploading.

@Eric_Zhang I actually solved my problem. Thank you very much!

 

Is there anyway to do advanced conditional formatting? Right now I'm only seeing the gradient option. I want to have the cells filled green if the difference is 0 or greater and red if it is below 0. I don't see that as an option currently.


@kdeff6006 wrote:

@Eric_Zhang I actually solved my problem. Thank you very much!

 

Is there anyway to do advanced conditional formatting? Right now I'm only seeing the gradient option. I want to have the cells filled green if the difference is 0 or greater and red if it is below 0. I don't see that as an option currently.


@kdeff6006

You can apply "color by rules".

Capture.PNG

@Eric_Zhang I cannot find that feature. All I see is the gradient option


@kdeff6006 wrote:

@Eric_Zhang I cannot find that feature. All I see is the gradient option


@kdeff6006

Try to download the latest Power BI desktop.

@Eric_Zhang Thanks for your help!

@Eric_Zhang ,

 

I have two tables order and in-hand quantity. These 2 tables are related. Order table has order # and ordered item and ordered qty.  In-hand table has  quantity stored for ordered item. I need to calculate difference between ordered and in-hand quantity columns from these 2 tables. Also I need to check if in-hand quantity is more then result should be 0 else difference between those columns. How can I achieve this?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors