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
chewkarann
New Member

Calculate between two fact tables

Dear Forum Community, 

 

First time posting here.  Hope you could help.

 

I have two fact tables as below:

 

.dax two fact tables.png

Each "Staff" could be associated to one or *more* "Department" in every month.  Each "Department" has one "Income" every month.  

 

For each Staff, I need to get the "Total Income" and the "Average Income", across all the "Department" he/she associated to.  Two values required: a) total and average across all the months, b) total and average in each month.  

 

What is the DAX measure code to get these values?  

 

Then, in my visual, I will plot graph/table showing the value for each month, using "Calendar[Month]" as my axis/row.  

 

Kind regards, 

Kar Ann 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@chewkarann Maybe:

Measure Each Month =
  VAR __StaffDept = DISTINCT('Fact Staff'[Department])
  VAR __Table = FILTER('Fact Department', [Department] IN __StaffDept)
  VAR __Total = SUMX(__Table, [Income])
  VAR __Average = AVERAGEX(__Table, [Income])
  VAR __Result = __Total // __Average
RETURN
  __Result


Measure All Months =
  VAR __StaffDept = DISTINCT('Fact Staff'[Department])
  VAR __Table = FILTER(ALL('Fact Department'), [Department] IN __StaffDept)
  VAR __Total = SUMX(__Table, [Income])
  VAR __Average = AVERAGEX(__Table, [Income])
  VAR __Result = __Total // __Average
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi @chewkarann,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

View solution in original post

3 REPLIES 3
chewkarann
New Member

@Greg_Deckler  THANKS so much, Greg!!  And sorry for the late reply.  

Anonymous
Not applicable

Hi @chewkarann,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Greg_Deckler
Community Champion
Community Champion

@chewkarann Maybe:

Measure Each Month =
  VAR __StaffDept = DISTINCT('Fact Staff'[Department])
  VAR __Table = FILTER('Fact Department', [Department] IN __StaffDept)
  VAR __Total = SUMX(__Table, [Income])
  VAR __Average = AVERAGEX(__Table, [Income])
  VAR __Result = __Total // __Average
RETURN
  __Result


Measure All Months =
  VAR __StaffDept = DISTINCT('Fact Staff'[Department])
  VAR __Table = FILTER(ALL('Fact Department'), [Department] IN __StaffDept)
  VAR __Total = SUMX(__Table, [Income])
  VAR __Average = AVERAGEX(__Table, [Income])
  VAR __Result = __Total // __Average
RETURN
  __Result


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.