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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
brockry1
Helper II
Helper II

Return a 1 if column has text in it using DAX

brockry1_0-1739562637946.png

How do I add another column that will bring back a value of "1" if the ID column contains text. 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@brockry1 Here is one way. PBIX attached below signature.

Column = 
    VAR __Len = LEN( [Id] )
    VAR __Table = 
        ADDCOLUMNS(
            ADDCOLUMNS(
                ADDCOLUMNS(
                    GENERATESERIES( 1, __Len, 1 ),
                    "__Char", MID( [Id], [Value], 1 )
                ),
                "__Unicode", UNICODE( [__Char] )
            ),
            "__IsText", 
                IF(  
                    ( [__Unicode] >= 65 && [__Unicode] <= 90 ) ||
                    ( [__Unicode] >= 97 && [__Unicode] <= 122 ),
                    1, 0
                )
        )
    VAR __Result = IF( COUNTROWS( FILTER( __Table, [__IsText] = 1 ) ) > 0, 1, 0 )
RETURN
    __Result

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@brockry1 Here is one way. PBIX attached below signature.

Column = 
    VAR __Len = LEN( [Id] )
    VAR __Table = 
        ADDCOLUMNS(
            ADDCOLUMNS(
                ADDCOLUMNS(
                    GENERATESERIES( 1, __Len, 1 ),
                    "__Char", MID( [Id], [Value], 1 )
                ),
                "__Unicode", UNICODE( [__Char] )
            ),
            "__IsText", 
                IF(  
                    ( [__Unicode] >= 65 && [__Unicode] <= 90 ) ||
                    ( [__Unicode] >= 97 && [__Unicode] <= 122 ),
                    1, 0
                )
        )
    VAR __Result = IF( COUNTROWS( FILTER( __Table, [__IsText] = 1 ) ) > 0, 1, 0 )
RETURN
    __Result

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Fowmy
Super User
Super User

@brockry1 


Not sure if I got your question.

Add a calculated column : 

INT( NOT ISBLANK(Tablename[ID]) && ISTEXT(Tablename[ID]) )

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.