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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Mark_Andersen
New Member

Average age with DIM and FACT

Hi community

 

I have a problem calculate the average age per year and show it in a graph.

Thanks for the help in advance.

 

DIM_Employee

Employee ID

Age

140
250
345
460
530

FACT_Employee

Employee ID

Date active

101-10-2019
101-11-2019
201-12-2019
101-10-2020
201-11-2020
301-11-2020

 

Result november with page filter on month

2019 = 40 / 1 (count employee) = 40

2020 = 95 (50 + 45) / 2 (count employee) = 47,5

1 ACCEPTED SOLUTION
Mark_Andersen
New Member

Thank you for your reply. 
The problem with sum('DIM_Employee'[Age]) is that it will sum employees with no match in FACT_Employee.

I need something like total sum DIM_Employee[age] if employee ID match with FACT_employee ID / Distinctcount(FACT_Employee[Employee ID)

 

 

View solution in original post

3 REPLIES 3
Mark_Andersen
New Member

Thank you for your reply. 
The problem with sum('DIM_Employee'[Age]) is that it will sum employees with no match in FACT_Employee.

I need something like total sum DIM_Employee[age] if employee ID match with FACT_employee ID / Distinctcount(FACT_Employee[Employee ID)

 

 

ryan_mayu
Super User
Super User

@Mark_Andersen 

you can create a calendar table. Then create a measure

Measure = sum('DIM_Employee'[Age])/COUNTROWS(FACT_Employee)

please see the attachment.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Mark_Andersen , Create a column in the table

year active= year([Date active])

 

Avg Age = divide(sum(Table[Age]), distinctcount(Fact[year Active]))

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

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.