Forum Discussion

chewkarann's avatar
chewkarann
New Member
3 years ago
Solved

Calculate between two fact tables

Dear Forum Community,    First time posting here.  Hope you could help.   I have two fact tables as below:   . Each "Staff" could be associated to one or *more* "Department" in every month...
  • Greg_Deckler's avatar
    3 years ago

    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
  • Anonymous's avatar
    Anonymous
    3 years ago

    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