Forum Discussion
Add data to a table from another table as long as it does not exist
I have some data that I am pulling in via a SQL query, I'll call this the PingTable, which is in the format;
| SerialNum | Version | FirstPing |
| AAA111 | 10 | 01/02/2018 |
| AAA222 | 7 | 01/02/2015 |
| AAA333 | 8 | 01/02/2016 |
| AAA444 | 10 | 01/02/2018 |
| AAA555 | 10 | 01/02/2018 |
| AAA666 | 9 | 01/02/2017 |
| AAA777 | ||
| AAA888 | 10 | 01/02/2018 |
| AAA999 | 9 | 01/02/2017 |
| BBB111 | 8 | 01/02/2016 |
This data is the serial number of the product, the version of said product and the date the product first pinged a server. Due to the way this database is mananged the data is rolled up periodically so the FirstPing date can change, this is where the problem lies. What we like to do is generate a transactional table of when each serial number changes version, so we can track how well the deployment is going and analyse the effectiveness of various communitcation channels.
I'm open to suggestions on how to do this but I think the easiest way would be to start with a blank table, I'll call this the VersionTable, and when we refresh the PingTable there is some form of M/DAX expression which looks at the data in the PingTable, checks if the SerialNum from the PingTable exisits in the VersionTable, if it does not exist it adds a row of data like this;
| SerialNum | Version | FirstPing |
| AAA111 | 11 | 01/09/2018 |
If it does exist in the VersionTable then it does not add any data. Therefore we will only have one row per SerialNum in the VersionTable along with an uncorruptable date of when it first installed the new version.
Thanks in advance.
- Anonymous8 years ago
mark_carlisle,
Please check if Append2 table in the following PBIX file returns your expected data.
https://1drv.ms/u/s!AhsotbnGu1Nok321_Rc7rANaAsAd
Or check if Append1 table in this PBIX file works in your scenario.
Regards,
Lydia
1 Reply
- AnonymousNot applicable
mark_carlisle,
Please check if Append2 table in the following PBIX file returns your expected data.
https://1drv.ms/u/s!AhsotbnGu1Nok321_Rc7rANaAsAd
Or check if Append1 table in this PBIX file works in your scenario.
Regards,
Lydia