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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
aaron797
Advocate I
Advocate I

Create Column Avg Group by

Hi,

 

We have a survey, with a set number of questions, each question is assigned a "camp" they belong to. 

A person can be considered engaged in a camp if the average of their answers for the questions (for that camp) is greater than or equal to 3.

I am needing to get a measure that will tell me the number of engaged employees for each camp.

 

My approach would be to create a column, which is the average of answer, grouped by camp and ID, return IF AVG(ianswer) is >= 3," Engaged", else "Disengaged". However i am struggling with the correct syntax.

 

Currently, my data set looks like this,

UserIDQuestionIDCampAnswer
1113
1214
1322
1424
2114
2214
2322
2421

 

My desired output is 

UserIDQuestionIDCampAnswerCamp Engaged
1113Engaged
1214Engaged
1322Engaged
1424Engaged
2114Engaged
2214Engaged
2323Disengaged
2421Disengaged

 

image.png

Would appreciate any tips for this!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Try

Camp Engaged = if(AVERAGEX(FILTER('Table','Table'[UserID]=EARLIER('Table'[UserID]) && 'Table'[Camp]=EARLIER('Table'[Camp])),'Table'[Answer])>=3,"Engaged","Disengaged")

 

refer

https://www.dropbox.com/s/lr09ews92zhlka5/898625.pbix?dl=0

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

Try

Camp Engaged = if(AVERAGEX(FILTER('Table','Table'[UserID]=EARLIER('Table'[UserID]) && 'Table'[Camp]=EARLIER('Table'[Camp])),'Table'[Answer])>=3,"Engaged","Disengaged")

 

refer

https://www.dropbox.com/s/lr09ews92zhlka5/898625.pbix?dl=0

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Perfect, appreciated the PIBX file too. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.