Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
v-rahyadav
Employee
Employee

Issue related to Power BI DAX.

Text function in DAX return uppercase characters instead of the lowercase characters.

vrahyadav_0-1638542994559.jpeg

 

1 ACCEPTED SOLUTION

Hi @steffens ,

 

I don't consider this to be a bug in my opinion in Power BI. This is how the DAX engine works.

Also the values in the column are in different casing in the source data. It is not something that Power BI has added.

If the casing of the data displayed is of prime importance, then this needs to be handled at the time you load data into Power BI in Power Query editor - by changing the casing of your column using the following Transform option on your string column:

Pragati11_0-1638831930623.png

In this way you handle the casing issues in the source data in Power BI and make the data values more consistent from casing point of view - either all in lowercase or all in uppercase.

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

6 REPLIES 6
steffens
New Member

Thanks All,

You guys were very helpfull.  I consider this to be a  bug in Power BI that needs fixing. Our customers pay for their licenses and plan fees, so if the data is stored in upper or lowercase (no matter which occurs first), when retrieved or loaded it must be exactly the same

Hi @steffens ,

 

I don't consider this to be a bug in my opinion in Power BI. This is how the DAX engine works.

Also the values in the column are in different casing in the source data. It is not something that Power BI has added.

If the casing of the data displayed is of prime importance, then this needs to be handled at the time you load data into Power BI in Power Query editor - by changing the casing of your column using the following Transform option on your string column:

Pragati11_0-1638831930623.png

In this way you handle the casing issues in the source data in Power BI and make the data values more consistent from casing point of view - either all in lowercase or all in uppercase.

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

smpa01
Super User
Super User

@v-rahyadav  DAX is case insensitive and probably M is the better choice for this kind of string manipulation.

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
Pragati11
Super User
Super User

HI @v-rahyadav ,

 

So, I tried MID dax expression on the following column that I have with just 4 values in it:

Pragati11_0-1638566976617.png

Scenario 1: DAX expression used to retrieve 1st character of every value in the column:

 

stringTest1 = 
MID(ClothingSales[Category], 1, 1)

 

This returns 1st character in uppercase as they are in my source data:

Pragati11_1-1638567068230.png

 

Scenario 2: DAX expression to retrieve 2nd character of every value in the column:

 

stringTest1 = 
MID(ClothingSales[Category], 2, 1)

 

This returns 2nd character in lowercase as they are in my source data:

Pragati11_2-1638567176955.png

So the DAX function seems to be working fine at my end.

#################################################################################

So basically, I would say DAX is not the problem. It is the way DAX engine works.

The DAX engine decides the casing of text alphabets based on the first casing of the text value it encounters in the column.

In your case, I bet the first value in your column has a UPPERCASE text value - so "B" is returned.

 

To test the hypothesis, just cnsider the values in the column below - so the 1st one has Uppercase B and 2nd one has Lowercase b:

Pragati11_0-1638569179667.png

But the DAX returned result in uppercase B.

 

Similarly, if I reverse the casing of first value in my column to lowercase and 2nd values to Uppercase:

Pragati11_1-1638569604594.png

The returned value using DAX is in Lowercase "b" - because DAX decided it based on the 1st text value casing that it encountered in the column.

 

You can read more about this on SQLBI website here: 

https://www.sqlbi.com/articles/letter-case-sensitivity-in-dax-power-bi-and-analysis-services/

 

So here DAX is not the issue, it is the way data is defined.

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11  try with same string, you will see

 

smpa01_0-1638568287922.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

HI @smpa01 ,

 

In your scenario LEFT dax function returns everything in lowercase. The reason for this is the DAX engine.

The DAX engine decides the casing of text alphabets based on the first value it encounters in the column.

In your case, both the value only have ONE alphabet, i.e., "b" & "B". So, when you execute a DAX on this column the return value is decided by the value casing that appears first in the order - in your case it is LOWERCASE, so "b" is returned.

 

To test the hypothesis, just reverse the order of the values in your column - so the 1st one has Uppercase B and 2nd one has Lowercase b:

Pragati11_0-1638569179667.png

But the DAX returned result in uppercase B.

 

 You can read more about this on SQLBI here: 

https://www.sqlbi.com/articles/letter-case-sensitivity-in-dax-power-bi-and-analysis-services/

 

So here DAX is not the issue, it is the way data is defined.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors