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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
DAX_n00b
Frequent Visitor

Survey evaluation: column with multiple answers

Afternoon everyone,

 

I am trying to calculate the percentage for each individual answer (a to h) stored as their combination in column I8:
sample.png

The idea is to create 8 measures (one for each letter) where the number of occurences divided by the number of rows should get the desired outcome. However, my best effort led to this and it gives no results. 
Funnily enough, it gives no error either:
outcome.png

e_perc:=
DIVIDE(

CALCULATE(

COUNTROWS(Survey),

ISNUMBER(FIND("e", Survey[I8]))

),

COUNTROWS(Survey)

)

The data sample seen above should give e_perc = 50%.
Have tried it with asterisks FIND("*e*" , no luck.

If the source data could be kept as they are without unpivotting and splitting the I8 answer to individual lines... that would be much-much appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @DAX_n00b ,

I created the table and copied your code to a Calculate Column to get the error that the use of the FIND function is not supported, so I won't get any results.

vyilongmsft_3-1707269911499.png

Here is how I did it, first you can create a new ContainE column to count the number of occurrences of the letter "e".

ContainsE = IF(CONTAINSSTRING('Survey'[I8], "e"), 1, 0)

vyilongmsft_0-1707269675520.png

Then you can write a new column E_Percentage to calculate the percentage of occurrences of the letter e in all rows, which will give you the result of 50%.

E_Percentage = 
VAR E_Count = SUMX(FILTER('Survey','Survey'[ContainsE] = 1),1)
VAR Total_Rows = COUNTROWS('Survey')
RETURN
FORMAT(DIVIDE(E_Count,Total_Rows),"0%")

vyilongmsft_1-1707269835919.png

vyilongmsft_2-1707269854896.png

 

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

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

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @DAX_n00b ,

I created the table and copied your code to a Calculate Column to get the error that the use of the FIND function is not supported, so I won't get any results.

vyilongmsft_3-1707269911499.png

Here is how I did it, first you can create a new ContainE column to count the number of occurrences of the letter "e".

ContainsE = IF(CONTAINSSTRING('Survey'[I8], "e"), 1, 0)

vyilongmsft_0-1707269675520.png

Then you can write a new column E_Percentage to calculate the percentage of occurrences of the letter e in all rows, which will give you the result of 50%.

E_Percentage = 
VAR E_Count = SUMX(FILTER('Survey','Survey'[ContainsE] = 1),1)
VAR Total_Rows = COUNTROWS('Survey')
RETURN
FORMAT(DIVIDE(E_Count,Total_Rows),"0%")

vyilongmsft_1-1707269835919.png

vyilongmsft_2-1707269854896.png

 

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yilong Zhou

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.