Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

3 Connected Tables and adding a measure

Hi,    I have 3 tables that are connected. (One is from a SQL database and two from an excel file.      Here is the graph its showing. I am trying to add a measure that takes the differenc...
  • v-echaithra's avatar
    1 year ago

    Hi Anonymous ,

    Thank you for reaching out to Microsoft Community.
    COUNTA and SUM operate in different table contexts, this results in an incorrect aggregation when used in visuals like matrices. Try this DAX measure:
    Difference in Total to Budgeted =
    VAR Staffcount = CALCULATE(COUNTA('HR table'[Full Name]))
    VAR Budgeted = CALCULATE(SUM('dir or ind'[Budget]))
    RETURN
    Staffcount - Budgeted

    If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

    Thanks,
    Chaithra E.