March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I have two tables from two different databases that keep track of our sales orders. My goal is to create a report to see how accurate these databases are to each other but I am running into an interesting issue.
I have joined the tables together on SalesOrderNo but in one database the sales order number is listed as "IA381" meanwhile in the other the same SO# is listed as "00IA381". This is causing the relationship not to work correctly. I want to add a related column in my SO_SalesOrderHeader that grabs the SalesOrderNo from the separate connected database and then I would add another column afterward that compares those two against each other.
So basically it would look like this -
SalesOrderNO | DATE | ORDERTYPE | GenesisSalesOrderNO (related column) | SalesOrdersMatch? |
00IA381 | 01/01/2021 | O | IA381 | YES |
00DC046 | 01/18.2022 | O | DC046 | YES |
This doesnt work now though since the Related() function cant work because it cant find the GenesisSalesOrderNo since 00IA381 doesnt match IA381. Im trying to refrain from automatically trimming the leading zeroes of off the SO# because the true SO# does need those zeroes to be accurate. Im not completely against inserting two 0's in the table from the DB that is trimming them off already but im not sure how to do that so any help would be appreciated.
Solved! Go to Solution.
My little walkthrough:
I insert both tables, go to table1, insert "New column" (I fix the date column later, not shown here)
The function:
SalesOrderShort = right('Table'[SalesOrder],len('Table'[SalesOrder])-2)
I create a relationship: Be aware of the right direction depands on your real data. It is not clear in the moment for me. I choose this directions because the on Order misses in the other table
Then you can check the result:
Before going further in the walkthrough. My question is if you have to check also the Date column:
Are Sales Order and Date column euqal?
Proud to be a Super User!
Make please a example for the table how it looks now and how you want to change it. Than its easier to help 🙂
Proud to be a Super User!
two tables-
table1
SalesOrder | Date |
00IA381 | 01/10/2022 |
00DC63 | 01/15/2022 |
table 2
SalesOrder | Date |
IA381 | 01/10/2022 |
I expect the following returned in table1
SalesOrder | Date | IsPresentInTable2? |
00IA381 | 01/10/2022 | YES |
00DC63 | 01/15/2022 | NO |
My little walkthrough:
I insert both tables, go to table1, insert "New column" (I fix the date column later, not shown here)
The function:
SalesOrderShort = right('Table'[SalesOrder],len('Table'[SalesOrder])-2)
I create a relationship: Be aware of the right direction depands on your real data. It is not clear in the moment for me. I choose this directions because the on Order misses in the other table
Then you can check the result:
Before going further in the walkthrough. My question is if you have to check also the Date column:
Are Sales Order and Date column euqal?
Proud to be a Super User!
This makes sense to me! I got it working, no I didnt need to do anything with the date yet hopefully should be good.
Thank you for your help!!
Sure, use calculated columns. Than you have both columns. One for join, a other one for showing something in a matrix.
Proud to be a Super User!
Im not sure what you mean. Ive tried adding a column using related( Table2[SalesOrderNo] ) but it just returns a blank since the SO#s dont match. What would be the correct way to add a calculated column to table2 where it takes the shortened sales order and adds two leading zeros to it?
What is now the problem, to remove this "00" ? If it alway "00" and not "000" or "0" -> mynewcolumn = right(SalesOrderNo,len(SalesOrderNo)-2))
Proud to be a Super User!
Is there a way to alter table2 (the table that is already autotrimming the leading zeroes) to add the zeros back on? And then I can just join table1 00IA381 on to the newly altered table2 IA381 (now 00IA381) value?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |