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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Create a table of measures

I have a table like this:

survey_idquestion_nameanswerperson_id
1question1yes1
1question1no2
1question1no3
1question1no4
1question1yes5
2question1yes1
2question1yes2
2question1yes3
2question1no4
1question2no6
1question2no7
1question2yes8
1question2yes9
2question2yes5
2question2no6
2question2no7

 

So I calculate a simple % of yes answeres per survey. Also, I calculated average of previous measure between surveys.
For %:

%_ =
var tom = CALCULATE(DISTINCTCOUNT(table[person_id]), 'table'[answer] = "yes", question = "question1")
var tot = CALCULATE(DISTINCTCOUNT(table[person_id]), ALL('table'[answer]), question = "question1")
return tom/tot
same for quesion2
 
Average between surveys:
%Q1_unaided average per survey =
AVERAGEX(KEEPFILTERS(VALUES('table'[survey_id])), CALCULATE([%_]))


The problem, I need to plot it like that:
Gleb_1-1668876555448.png

and be able to filter it by survey, so only blue bar will change, average is static.

I hope I covered all and delivered the problem well. Thanks in advance. ( The visual could be a bit different, it could be a space betwen blue and gray bars


 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Anonymous,

Did you mean to modify the formula to auto-fit each question types in your formula? If that is the case, you can try to use following measure formula to replace the raw percentage formula:

%_ =
VAR tom =
    CALCULATE (
        DISTINCTCOUNT ( table[person_id] ),
        FILTER ( 'table', 'table'[answer] = "yes" ),
        VALUES ( 'table'question )
    )
VAR tot =
    CALCULATE (
        DISTINCTCOUNT ( table[person_id] ),
        ALLSELECTED ( 'table' ),
        VALUES ( 'table'question )
    )
RETURN
    tom / tot

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

Did you mean to modify the formula to auto-fit each question types in your formula? If that is the case, you can try to use following measure formula to replace the raw percentage formula:

%_ =
VAR tom =
    CALCULATE (
        DISTINCTCOUNT ( table[person_id] ),
        FILTER ( 'table', 'table'[answer] = "yes" ),
        VALUES ( 'table'question )
    )
VAR tot =
    CALCULATE (
        DISTINCTCOUNT ( table[person_id] ),
        ALLSELECTED ( 'table' ),
        VALUES ( 'table'question )
    )
RETURN
    tom / tot

Regards,

Xiaoxin Sheng

Jayee
Responsive Resident
Responsive Resident

Hi @Anonymous 

 

Try this measure

 

%Q1_unaided average per survey =
AVERAGEX(KEEPFILTERS(VALUES('table'[survey_id])), CALCULATE([%_],all(question)))

 

If this post helps, then please consider Accept it as the solution, Appreciate your Kudos!!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.