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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
a68tbird
Resolver II
Resolver II

Comparing Data and Values Between Two Tables

Hello All -

  I have two tables, Sales and SalesUpload.  Both tables have the same columns, and all data types match.  I need to find the variances/differences between the two tables, and identify which rows are producing those variances. I created a table using the EXCEPT function,:

Variance = EXCEPT(Sales,SalesUpload)

but I received this error: "Function 'EXCEPT' does not support joining a column of type Date with a column of type Text." I couldn't quite understand this since all of the data types are correct and appropriate. Turns out (and I believe this is where the problem is originating) that if I view the two tables in the "Data" view, the column order is different - even though, if I edit the queries, the columns in both tables are in the same order.  Somehow, when I load the query, the column order gets changed. Don't know how to fix that, since you can't move columns around in the "Data" view. 

 

So, if I it's possible to correct that column ordering, would the EXCEPT function return rows where the sales total value is different? If not, how could I go about comparing the values between the two tables? The data gets kind of granular - the columns are:

 

a68tbird_0-1640903406635.png

 

Thanks for any help. 

 

7 REPLIES 7
parry2k
Super User
Super User

@a68tbird sounds good. Let me know if you need further assistance. at least you are one step closer 🙂

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@a68tbird can you make sure RecognizationDate doesn't have any space in the front of one of the tables. in the Power bi data model, columns are sorted alphabetically, so in the Sales table case RecognizationDate is at the end and that tells me that it has probably space or other character making it not to sort alphabetically, and that's probably is the issue.

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k .  There were no spaces or strange characters in that column name. I copied the column name from one table to the other, so that I knew they would be the same, and that didn't help. Even renamed the columns, and didn't change anything.  So I removed that column (I could probably get by without needing it), and finally got the EXCEPT table to work.  But it seems to be returning way more than I was expecting.  I can see that there is a bit of a difference in the totals between the two tables, but the Variance table is returning 100 times as much.  Will have to examine the data or find another solution to this.

parry2k
Super User
Super User

@a68tbird source type for the 2nd screen shot is any not text, and also when you say orders get changed, where you see these change of orders, share the screen shot?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Good catch.  🙃

 

Here's how the tables look when viewing in the "Data" tab:

a68tbird_0-1640904881129.pnga68tbird_1-1640904920341.png

 

 

 

parry2k
Super User
Super User

@a68tbird yes, they both need same number of columns, in same order and same data type

 

Follow us on LinkedIn

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k - as mentioned, I've made sure that both tables have the same columns, and data types all match.  Here are screenshots of both:

 

a68tbird_0-1640904358385.png

a68tbird_1-1640904419064.png

However, the column order changes when I "Close & Apply", and as such creates that error on the EXCEPT function. 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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