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
LijunChen
Resolver I
Resolver I

Count specific text values across Several Columns

Hi Friends,

 

I have a question about creating a column in Power BI editor table that counts the number of a specific text value across several columns.   See the screenshot below, I would like to count how many of the 4 columns ("Was question 1,2,3,4 resolved"?) have a vlaue of "Yes". 

LijunChen_0-1670349682787.png

There is an similar question asked in this forum, and the solution is to use the "List.Count(List.Select(Record.FieldValues(_), (x) => Text.Contains(x, "Yes")))" formulae. I tried this in my case, but what I got is just Errors, although the no syntax errors are detected, as shown in the Screenshot below.

LijunChen_1-1670350318643.png

I don't know why the formulae does not work in my case, or why it worked in the original case. Is there anyway I can get the count of the values in one step? Thanks.

1 ACCEPTED SOLUTION

Thanks, Hotchilli, 

 

Here is the screenshot for the error message. It says " ... cannot convert value 11 to Type text". It is the first ID value, which is a numeric field. I have several numeric field, I think the problem is with the numeric fields.  

LijunChen_0-1670970273147.png

So I excluded all numeric fields from the table, and do the formulae again. This time it works perfect.

See screenshot below.  

LijunChen_1-1670970698343.png

So it seems the formula only works for data with no numeric fields. So if I want to keep my numeric fields in the table, what revision should be made to the formula so it will ignore the numeric fields? 

 

Thanks,

 

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

Post the Error text please.

You click in the Error cell (but not on the word itself)

Thanks, Hotchilli, 

 

Here is the screenshot for the error message. It says " ... cannot convert value 11 to Type text". It is the first ID value, which is a numeric field. I have several numeric field, I think the problem is with the numeric fields.  

LijunChen_0-1670970273147.png

So I excluded all numeric fields from the table, and do the formulae again. This time it works perfect.

See screenshot below.  

LijunChen_1-1670970698343.png

So it seems the formula only works for data with no numeric fields. So if I want to keep my numeric fields in the table, what revision should be made to the formula so it will ignore the numeric fields? 

 

Thanks,

 

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
Top Kudoed Authors