SQL Type UniqueIdentifier converted to text behaves differently in M vs DAX
I have two databases with a column Id in them. In one of the databases the Id column has type UniqueIdentifier. In the other database the type is varchar(50) as it contains ids in different formats. When you look at the Ids in SQL Management Studio they look like this:
When you import data into Power BI they look like this.
Power BI has converted the UniqueIdentifier to text and made it lower case as a GUID should be formatted according to RFC4122. If you merge the data in query mode it looks great.
However when you close and apply and look at the data it looks like this:
For some reason the Id column that was UniqueIdentifier originally is now represented with upper case and the merge fails as Source2 id is nvarchar that retains its capitalization.
In order to get this merge to work you need to perform an additional step of lowercase in query editor.
There seems to be some sort of glitch with how the data is represented and this could be quite difficult for a user to understand why it behaves like this.
If you create a connection using model you can join these tables without any problem.
Basically DAX is case-insensitive and when it's storing strings, if it comes across anothjer string that is identical to one that it has already encountered, the second string is stored exactly the same as the first string.
So if it finds ABCD in your data first, then finds abcd, the 2nd string, abcd, actualy gets stored as ABCD.
So I suspect that DAX is finding your upper case ID first and storing all occurrences of it in upper case.
Did I answer your question? Then please mark my post as the solution. If I helped you, click on the Thumbs Up to give Kudos.