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
cantona7
Frequent Visitor

create measure based on textcolumn

Hi all.

 

How do you in dax create a measure (not interested in creating a calculated column) based on a text column.

I have a table containing ColumnA so whenever ColumnA is blank then for that row I would like it to be marked with 1 and else 0 - something like this:

# ColumnA NewMeasure (NOT calculated column)

1 textABC     0

2                   1

3 textBCD     0 

***

IF(sumx(table,table[ColumnA) = " ",1,0) I know this is not working, but just to show my thoughts

So that I later on can sum on this NewMeasure, and I would not only show rows where NewMeasure = 1 but all rows.

 

Thanks in advance

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@cantona7 , check one of the two

 

sumx(table,if(table[ColumnA] = " ",1,0))

 

or

 

if(isblank(sum([ColumnA] )) ,1,0)

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@cantona7 , check one of the two

 

sumx(table,if(table[ColumnA] = " ",1,0))

 

or

 

if(isblank(sum([ColumnA] )) ,1,0)

thanks a lot 🙂 this worked:

 sumx(table,if(table[ColumnA] = " ",1,0)) BUT when asking if a string is blank it should be sumx(table,if(table[ColumnA] = "",1,0)) (without spaces between "" ) 

Thanks again

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