Saturday, April 28, 2018
Thursday, April 12, 2018
Re: Can´t create a relationship between two columns because one of the columns must have unique valu
encountered this issue when trying to establish the relationship between two tables, however when I used group by statement to find the duplication, nothing turned up.
I then imported these two tables into Power BI and use the countrows and distinctcount which revealed that there are indeed duplicated rows.
I then created a calculated column as below and put it into a grid , filter the RecordCount>1
RecordCount = COUNTROWS(filter(ALL('dw DmResources'), 'dw DmResources'[ResourceID]=EARLIER('dw DmResources'[ResourceID])) )
the above step showed what's duplicated.
I did a select with like statement in SQL to find the duplicated records, copy and paste to Excel and compare the two duplicated string char by char and Excel told me that the different was a space CHAR(32)
the funny thing started here, I used LTRIM in sql to remove the trailing space, I also tried repalce(xx, char(32),'') , no luck.
At the end I use the ASCII(SUBSTRING(xxx, m, k)) in the sql query and it told me that the difference is actually a TAB (CHAR(9) ), apparently when copying from SQL output to Excel, the process automatically convert the TAB to a space??? maybe it is due to the fact that in Excel you can't enter a tab because it is a reserved function key?
Problem finally solved after all these drama.
I then imported these two tables into Power BI and use the countrows and distinctcount which revealed that there are indeed duplicated rows.
I then created a calculated column as below and put it into a grid , filter the RecordCount>1
RecordCount = COUNTROWS(filter(ALL('dw DmResources'), 'dw DmResources'[ResourceID]=EARLIER('dw DmResources'[ResourceID])) )
the above step showed what's duplicated.
I did a select with like statement in SQL to find the duplicated records, copy and paste to Excel and compare the two duplicated string char by char and Excel told me that the different was a space CHAR(32)
the funny thing started here, I used LTRIM in sql to remove the trailing space, I also tried repalce(xx, char(32),'') , no luck.
At the end I use the ASCII(SUBSTRING(xxx, m, k)) in the sql query and it told me that the difference is actually a TAB (CHAR(9) ), apparently when copying from SQL output to Excel, the process automatically convert the TAB to a space??? maybe it is due to the fact that in Excel you can't enter a tab because it is a reserved function key?
Problem finally solved after all these drama.
Subscribe to:
Posts (Atom)
Disable Microsoft Defender for Cloud for Visual Studio Subscription (MSDN)
I use a visual studio pro subscription which comes with $150 azure cloud credit, for some reason Microsoft Defender for Cloud was turned on ...
-
Error 15401: Windows NT user or group '%s' not found. Check the name again. SELECT name FROM syslogins WHERE sid = SUSER_SID ('Y...
-
Finally, it is time. E4SE 811 and eBackoffice 736 will replace our current 810b/735a environment after staying so many years. Just got the n...
-
/etc/ipsec.config conn ios keyexchange=ikev1 authby=xauthrsasig xauth=server lef...