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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
IoannisT
Advocate I
Advocate I

Count specific words separate by comma on row and exclude empty cells

Hi Fabric community.

 

I have had a search around and found partially the solution but I am having trouble excluding empty cells on the following count.

They say 1 photo is 1000 words so here is the problem with attached DB 

IoannisT_0-1715338196259.png


- I am using the following measure but null values are counted as "1!

DoA_Individual_Count = 
SUMX(
    'test',
    LEN('test'[Approved_Actions])
        -LEN(
            SUBSTITUTE(
                'test'[Approved_Actions],
                ",",
                ""
             )
        )+1)

 

Any ideas?

User_ID	Approved_Actions	Count_of_approved_Actions
1	a	1
2	a,b	2
3	a,c	2
4	b,c,d	3
5	d	1
6	a	1
7		"0" or "null"
8	d	1
9		"0" or "null"
10		"0" or "null"

 

2 ACCEPTED SOLUTIONS
Kishore_KVN
Solution Sage
Solution Sage

Hello @IoannisT ,

Please change your measure as below:

DoA_Individual_Count = 
IF(MAXX('Table','Table'[Approved_Actions])<>BLANK(),
SUMX(
    'Table',
    LEN('Table'[Approved_Actions])
        -LEN(
            SUBSTITUTE(
                'Table'[Approved_Actions],
                ",",
                ""
             )
        )+1),0)

Output looks as below:

Kishore_KVN_0-1715340609678.png

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

View solution in original post

DataNinja777
Super User
Super User

Hi @IoannisT ,

 

You can produce your required output in the following manner by tweaking your formula.  

DataNinja777_0-1715342214958.png

I attach a pbix file as an example.  

View solution in original post

4 REPLIES 4
DataNinja777
Super User
Super User

Hi @IoannisT ,

 

You can produce your required output in the following manner by tweaking your formula.  

DataNinja777_0-1715342214958.png

I attach a pbix file as an example.  

Thank you very much. Wordek like a charm

Kishore_KVN
Solution Sage
Solution Sage

Hello @IoannisT ,

Please change your measure as below:

DoA_Individual_Count = 
IF(MAXX('Table','Table'[Approved_Actions])<>BLANK(),
SUMX(
    'Table',
    LEN('Table'[Approved_Actions])
        -LEN(
            SUBSTITUTE(
                'Table'[Approved_Actions],
                ",",
                ""
             )
        )+1),0)

Output looks as below:

Kishore_KVN_0-1715340609678.png

If this post helps, then please consider accepting it as the solution to help other members find it more quickly. Thank You!!

Thank yo uso much. It works!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.