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
Anonymous
Not applicable

Display Percentage of Each Response per Question Across Year

I am trying to create a column chart to show the percentage of each response option across each year. For example, for question 1, I want to know the percentage of people who responded agree vs disagree for 2015, 2016, 2017, and 2018. I have Q1 as the axis and SurveyYear as the Legend. When I use Q1 as the value, it gives me the percentage of each response grand total and not yearly total. To fix this, I created a new measure for the value: 

 

#ofRespondentsT = DIVIDE(COUNTA(Satisfaction_Survey[Q1]), CALCULATE(COUNTA(Satisfaction_Survey[Q1]), ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])))
 
My issue is that I want to omit anyone who didn't respond to that question (BLANK), AND those who responded NA-Not Applicable, but my current measure is including those in the formula. How do I edit my measure so both BLANK and NA-Not Applicable are omitted? I have attached a photo of my sample data. 
 
Goal: Determine the percentage of each response option by year for Q1 omitting NA and BLANK from total responses.
 
example data.jpg
 
1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Anonymous

 

Try the following:

 

DIVIDE(CALCULATE(COUNTA(Satisfaction_Survey[Time]), Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"

, CALCULATE(COUNTA(Satisfaction_Survey[Time])

, ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear]))

, Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"

)

 

View solution in original post

13 REPLIES 13
themistoklis
Community Champion
Community Champion

@Anonymous

 

Try the following:

 

DIVIDE(CALCULATE(COUNTA(Satisfaction_Survey[Time]), Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"

, CALCULATE(COUNTA(Satisfaction_Survey[Time])

, ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear]))

, Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"

)

 

Anonymous
Not applicable

I am getting an error that says, "Too few arguments were passed to DIVIDEW function. Minimum argument count for the fuction is 2. 

@Anonymous

 

Well the formula needed more brackets.. try this one:

DIVIDE((CALCULATE(COUNTA(Satisfaction_Survey[Time]), Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"))

, (CALCULATE(COUNTA(Satisfaction_Survey[Time])

, ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])

, Satisfaction_Survey[Q1] <> BLANK(), Satisfaction_Survey[Q1] <> "NA-Not Applicable"))

)
Anonymous
Not applicable

Now I am getting "operator or expression '()" is not supported in this context. 

@Anonymous

 

Can you share the workspace with us if possible?

Anonymous
Not applicable

I know the matric is correct, but I cannot get my column chart percentages to match the matrix. 

 

Untitled.jpg

@Anonymous

 

also try removing this bit from the formulas used in graph

, ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])

@Anonymous

 

How the matrix differs from the chart?

Do you use different dimensions or measures?

Anonymous
Not applicable

In the Matrix, I use Count of Time (Time is considered Text data), and then %Count of Time (percent by column total) by year and Time (Strongly Agree - Strongly Disagree). When I use Time as a value in the Chart, it calculates the percentage of the Grand Total, and not by year, so I created the measure #of Respondents to calculate percentage of each response by year, but for some reason, it is including responses BLANK and NA - Not Applicable where I can easily filter those out in the matrix. 

 

#ofRespondentsT = DIVIDE(COUNT(Satisfaction_Survey[Time]), CALCULATE(COUNT(Satisfaction_Survey[Time]), ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])))

 

GRAPH.jpgMatrix.jpg 

@Anonymous

 

From your last message it is not clear where the problem is. I got a bit confused.

I thought you had issues with the 100%s on the chart??

Anonymous
Not applicable

My apologies! I took a few steps back to respond to your question about how the matrix differs from the chart and if I use differnt dimensions or measures. I don't get 100% columns with my original measure: 

 

#ofRespondentsT = DIVIDE(COUNTA(Satisfaction_Survey[Q1]), CALCULATE(COUNTA(Satisfaction_Survey[Q1]), ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])))

 

When I include BLANK and NA - Not Applicable responses in my matrix, the percentages equal the chart percentages, so for some reason, I am able to easily filter out these responses in the matrix, but they will not filter in the chart. 

 

Anonymous
Not applicable

I cannot share the workspace due to the sensitivity of the data 😞 

 

I tried the formula above, and I am not receiving any errors now, but each bar graph is coming back as 100% (I changed the format of the measure to be %). 

 

Time = Q1 

 

#ofRespondentsT = DIVIDE((CALCULATE(COUNTA(Satisfaction_Survey[Time]), Satisfaction_Survey[Time] <> BLANK(), Satisfaction_Survey[Time] <> "NA-Not Applicable"))

, (CALCULATE(COUNTA(Satisfaction_Survey[Time])

, ALLEXCEPT(Satisfaction_Survey,Satisfaction_Survey[SurveyYear])

, Satisfaction_Survey[Time] <> BLANK(), Satisfaction_Survey[Time] <> "NA-Not Applicable"))

)
Anonymous
Not applicable

Hi,

 

This site may help.

I hope it contains the information that you are looking for.

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.