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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
danextian
Super User
Super User

Function to check whether a text is in upper or lower case

Hi,

 

Is there an existing function to check whether a text is in  upper or lower case or do i still need to create a custom function?










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
1 ACCEPTED SOLUTION

No. You can create a custom function using Text.Lower and/or Text.Upper, like:

 

(Text as text) as logical =>
let
    IsTextAllUpperCase = Text.Upper(Text) = Text
in
    IsTextAllUpperCase
Specializing in Power Query Formula Language (M)

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

You could compare the string with the result of UPPER() on that string.

 

You must use the EXACT() function for this:

IsUpperCase = IF(EXACT(UPPER(data[string]), data[string]), TRUE(), FALSE())

PBIDesktop_2017-08-01_10-51-04.png

 

 

On a side note, I just noticed a bug with the Enter Data option (if you enter the same value in different casing, it just makes the casing consistent).

I used this to check Prefixes of constituents. If a person doesn't have a prefix it is returning a "True" value. Is there something I can add to ignore empty records?

IsUpperCase = IF(EXACT(UPPER(data[string]), data[string]), TRUE(), FALSE()) 

 

I should have been more specific. Is there one for M.









Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

No. You can create a custom function using Text.Lower and/or Text.Upper, like:

 

(Text as text) as logical =>
let
    IsTextAllUpperCase = Text.Upper(Text) = Text
in
    IsTextAllUpperCase
Specializing in Power Query Formula Language (M)

Thanks @MarcelBeug and @Anonymous

 

I didn't  think of comparing a letter to it's uppercase version. 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
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.