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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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

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.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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