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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
CarlosV
Regular Visitor

How can I compare values from 2 different sheets in Power BI?

Hello everyone

 

I have 2 table sheets in which they share common data and I would like to compare the difference between them to calculate the delta or differences with a filter condition. 

 

An example of this table would be as follows:

 

TABLE 1                                                     TABLE 2                                                    DELTA

                                                                                 

STATUS   PART NUMBER     QTY                STATUS    PART NUMBER     QTY       STATUS  PART NUMBER  QTY

OPEN        78124                 100                 OPEN         78124                  200         OPEN       78124             300     (100+400 - 200) 

OPEN        78125                 100                 OPEN         78125                  300         OPEN       78125             200

OPEN        78112                 300                 OPEN         78112                  300         OPEN       78112               0

CLOSE       78115                 400                 OPEN         78115                  350         OPEN        78115             150

CLOSE       78118                 500                 OPEN         78118                    80         OPEN        78118           520

OPEN        78115                 500

OPEN        78118                 600 

OPEN        78124                 400

 

In this example the comparison is only for the Open Status Condition, and it is between each part number of each table.

For Part number  78124 in table 1 it is repeated and the total is 500, and for table 1 part number 78124 in table 2 is 200, so if the difference is compared is equal to 200.

 

So at the end what I am looking for is to have a summary of quantities difference between table 1 and 2 with open status and per part number.

 

It kinds of messy if I miss information please let me know

I will appreciate any advice to create this table comparisson in power BI.

 

Thanks in advacne

 

Best regards

 

Carlos V

 

 

 

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Try this approach.  Make a table visual with the Part Number from Table1 and add this measure

 

Delta =

var currentpart = selectedvalue(Table1[PartNumber])

var table1open = calculate(Sum(Table1[Qty]), Table1[Status]="Open")

var table2open = calculate(sum(Table2[Qty]), Table2[Status]="Open", Table2[PartNum]=currentpart)

return table1open-table2open

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

2 REPLIES 2
mahoneypat
Employee
Employee

Try this approach.  Make a table visual with the Part Number from Table1 and add this measure

 

Delta =

var currentpart = selectedvalue(Table1[PartNumber])

var table1open = calculate(Sum(Table1[Qty]), Table1[Status]="Open")

var table2open = calculate(sum(Table2[Qty]), Table2[Status]="Open", Table2[PartNum]=currentpart)

return table1open-table2open

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Thank you, this did the job, I was breaking my head, thank you again for the advice.

 

Best regards!

 

Carlos V

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors