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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Measure to add multiple columns inside summarize and divide these columns

Hello,

I am trying to write a measure to count how many respondents used only one answer in a survey. (If their most frequent answer is used more than in 90 per cent, then I label them as "used only one answer")
The survey is getting data every year.


I have this input data:
(questions are various)

RespondentYearQuestionAnswer
12022Agree
12022….Disagree
12022Don't know
12022.Agree
12022.Disagree
22022Agree
22022.Disagree
22022.Don't know
22022.Agree
22022.Disagree
22022.Don't know

 

My solution recently:
Table with summarized rows for the same answer, respondent number, and year.
Then added a column to count occurrences for each answer by every respondent and a column for the number of all answers by the respondent.

RespondentYearAnswerNumber of answer occurenciesnumber of all answersDivide
12022Agree250,4
12022Disagree250,4
12022Don't know150,2
22022Agree260,333333
22022Disagree260,333333
22022Don't know260,333333

 

Then I have a measure, that filters the Divide column values above 0.9 and count rows.


I want to have only the measure using summarize etc because the output of this calculation is always only a number.

I tried to use function summarize, addcolumn and reletedtable, so I created the table displayed above with the number of answer occurrences. But I failed to get other "columns" using summarize, so I would be able to filter and count the rows only using input data and measure.

Thanks for your help 🙂

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Measure:

Number of answer occurencies =
CALCULATE (
    COUNT ( 'Table'[Answer] ),
    FILTER (
        ALL ( 'Table' ),
        [Respondent] = SELECTEDVALUE ( 'Table'[Respondent] )
            && [Answer] = SELECTEDVALUE ( 'Table'[Answer] )
    )
)
Number of all answers =
CALCULATE (
    COUNT ( 'Table'[Answer] ),
    FILTER ( ALL ( 'Table' ), [Respondent] = SELECTEDVALUE ( 'Table'[Respondent] ) )
)
Divide = DIVIDE([Number of answer occurencies],[Number of all answers])

vzhangti_0-1656916886523.png

Since the test data you gave is not greater than 0.9, let's first assume that filtering the trigger column for values greater than 0.35.

Measure = IF([Divide]>0.35,1,0)

Put the measure into Filter and set it equal to 1.

vzhangti_1-1656917124545.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Anonymous
Not applicable

Hi, @v-zhangti  thanks, but it is not exactly what I meant.

The result should be only the number of "rows" in column divide that are greater than 0,9.

I want to show the output only as a card in Power Bi. So there are no selected values etc. 

 

Do you understand? I know, that I my description is difficult, sorry.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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