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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Seum
New Member

Countif Contain Text from Other Column

I have a table of raw data, like the following:

 

Seum_0-1654264858263.png

Now I want to create a new DAX Measure to count the below table:

 

Seum_1-1654264904003.png

 

 

Please suggest new measure DAX Code or any other new process

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Seum,

 

You may try this solution.

1 Unpivot your table columns in Power Query Editor(Transform data) and remove unnecessary columns, then you will get a Product table

vcazhengmsft_0-1654585207458.png

 

2 Create a Calculated column with the following dax formula

alphabet = SELECTCOLUMNS( GENERATESERIES(UNICODE("A"),UNICODE("Z")),"Character",UNICHAR([Value]))

 

Build one-many relationship for these two tables

vcazhengmsft_1-1654585207459.png

 

3 Create a Measure to count the characters

COUNT =
VAR res =
    CALCULATE ( COUNT ( 'Table'[Product] ), VALUES ( 'Table'[Product] ) )
RETURN
    IF ( ISBLANK ( res ), 0, res )

 

Then, you will get the desired result.

vcazhengmsft_2-1654585207461.png

 

Also, attached the sample pbix file.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Seum 

I guess these are not just letters, they can be any text with any number of letters? But they are always separated with comma?

v-cazheng-msft
Community Support
Community Support

Hi @Seum,

 

You may try this solution.

1 Unpivot your table columns in Power Query Editor(Transform data) and remove unnecessary columns, then you will get a Product table

vcazhengmsft_0-1654585207458.png

 

2 Create a Calculated column with the following dax formula

alphabet = SELECTCOLUMNS( GENERATESERIES(UNICODE("A"),UNICODE("Z")),"Character",UNICHAR([Value]))

 

Build one-many relationship for these two tables

vcazhengmsft_1-1654585207459.png

 

3 Create a Measure to count the characters

COUNT =
VAR res =
    CALCULATE ( COUNT ( 'Table'[Product] ), VALUES ( 'Table'[Product] ) )
RETURN
    IF ( ISBLANK ( res ), 0, res )

 

Then, you will get the desired result.

vcazhengmsft_2-1654585207461.png

 

Also, attached the sample pbix file.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

daXtreme
Solution Sage
Solution Sage

It's an easy task but you have to change your data model. In Power Query use the transformations to have one letter per row, no commas. Best transformations are split column on delimiter and then unpivot. This will give you the format of data you need.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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