Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

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. 


Super User
Super User

Hi @MatjoCol 


I think what you are seeing is a result of the way DAX stores strings.  There's a good article about it here


Letter case-sensitivity in DAX, Power BI and Analysis Services - SQLBI


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.

Blog :: YouTube Channel :: Connect on Linkedin

Proud to be a Super User!

Thank you for your reply! 
I read the article but I cannot see how it applies here. 
Create the following example: 
Query1 (connect to random database)

SELECT CAST('0011661B-2AFC-4308-9550-1BC80576EDA1' as UniqueIdentifier) as Id, '2021-11-01' as Date1


Query2 (connect to random database)

SELECT CAST('0011661b-2afc-4308-9550-1bc80576eda1' as varchar(50)) as Id2, '2021-11-01' as Date2


Import these, merge query1 with query2 on id = id2. This will look good in query editor. But you will get NULL on the join after you have applied it. 

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors