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

Top Solution Authors