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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Mahi1827
Resolver I
Resolver I

How to summarize both distinct counts and averages based on group by column


I have 3 columns store,ID,Days. i need to summarize the Total ids and average of days from Store column.
ID and Days are from Table 1 and store from table 2 and relation is enabled with two tables with ID.

my test data like

store   ID   Days
A        101 10
A       102  20
A       103  30
B       104  40
B       105  50
B       106  60
B       107  70

In result table i need to summarize based on store and my expected output like below

 

store TotalIDs   AvgDays
A        3              20
B        4              55


Total ids should distinctcounts and avgdays should take average from Days

 

So i have crated 2 measures group by store for totalids and Avg days like below but its not working as expected.

 

Total IDs=CALCULATE (DISTINCTCOUNT ( Table1[ID ),ALLEXCEPT (Table2,Table2[store] ))

AvgDays= AVERAGEX(Values(Table1[Days]),DISTINCTCOUNT(Table1[ID]),ALLEXCEPT (Table2,Table2[store]))

 

When i use above 2 mesures and add to table view with store column i am getting overall counts and averages only in one row but not individual counts like expected output.

 

So please help me with your inputs and suggestions on to get expected summary in table view..

 

Thanks for your help in advance.

 

Thanks,

mahi1827

4 REPLIES 4
Anonymous
Not applicable

@Mahi1827 -

Do you want to do that in visual or you want to transform the table like this-

 

NikhilKumar_0-1603340425299.png

 

Appreciate your kudos!! Mark my post as solution if it helps.

Ashish_Mathur
Super User
Super User

Hi,

These measures should work

Total ID = countrows(data)

Average days = average(data[days])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi ,

Thanks for your time

Actually i have already  tried this same as provided measures  but i have got all summary data in id and days column like below.

 

Store Totalids   Avg days ( here its taking as overall data and overall average but not for individul records)

A         7            47.5

B         7            47.5

 

Myexpected output like

Store Total ids    avgdays

A        3                20

B         4               55

 

Please provide any possible solutions ..thank you.

 

Thanks,

Mahi

Hi,

My suggested measures should work.  Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.