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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
filarap
Helper III
Helper III

Average for Unique IDs per category and Total

Hi Community,

I am trying to create a measure that will calculate average for each unique case per category and for total, for the unpivoted table that has one row per category for each case (one case has 5 rows, but only some of those rows are applicable).

 

I would appreciate any guidance to how to achieve this. Currently I have this formula active:

AVERAGEX(SUMMARIZE(table,table[Case ID]),AVERAGE(table[CSAT])))

 

Below is unpivoted Raw data.
Applicable row needs to be used for category based calculation.

Case IDCategoryApplicable RowCSAT
1Wine17
1Beer17
1Spirit07
1Juice07
1Water07
2Wine09
2Beer09
2Spirit19
2Juice09
2Water09
3Wine13
3Beer13
3Spirit13
3Juice13
3Water13
4Wine15
4Beer05
4Spirit05
4Juice05
4Water15
5Wine110
5Beer010
5Spirit010
5Juice110
5Water010

 

 

Here is the output i need. I am able to get either correct calcualtion for category or for total, but not both ion the same visual (Matrix/table).

Categoryavg CSAT
Beer5
Juice6.5
Spirit6
Water4
Wine6.25
Total6.8
1 ACCEPTED SOLUTION
filarap
Helper III
Helper III

Hey

Managed to achieve it with this

Measure = CALCULATE(AVERAGE('Table'[CSAT]),FILTER(SUMMARIZE('Table','Table'[Case ID],"maxi",max('Table'[Applicable Row])),[maxi]=1))
Thanks all who took the time to look into this!!!

View solution in original post

3 REPLIES 3
filarap
Helper III
Helper III

Hey

Managed to achieve it with this

Measure = CALCULATE(AVERAGE('Table'[CSAT]),FILTER(SUMMARIZE('Table','Table'[Case ID],"maxi",max('Table'[Applicable Row])),[maxi]=1))
Thanks all who took the time to look into this!!!
amitchandak
Super User
Super User

@filarap , Try like

 

 

AVERAGEX(Values(table[Case ID]),calculate(AVERAGE(table[CSAT])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hey @amitchandak , thanks for the reply.

Unfortunatelly, it didnt work.

Got total in all rows (as below).

 

Categoryavg CSAT
Beer6.8
Juice6.8
Spirit6.8
Water6.8
Wine6.8
Total6.8

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.