Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Avoid Filter carrying across Multiple measures

I have a table with a month register for each employee I have a measure that calculates the last month I have registered

 

CalculatedLastMonth = CALCULATE(MAX(T_Staff_SAP[Month]))

 

This works well, in a Matrix table I have it show for example

 

                   2016 2017 2018 2019

Last Month    12      12    12   1

 

Then I have a formula that calculates the HQ for the latest month of that year:

 

CalculatedHQKLastMonth = CALCULATE(DISTINCTCOUNT(T_Staff_SAP[ID]),FILTER(T_Staff_SAP,T_Staff_SAP[Month]=[CalculatedLastMonth]))

 

And i get this:

 

       2016 2017 2018 2019

HQ   124   113  109   100

 

But if I put 12 as Calculated last Month on the Measure I get:

 

      2016   2017   2018   2019

HQ  100      99       98       0

 

Is like CalculatedLastMonth is getting the current month for each time it calculates the month, so I'm getting the distinct count for the whole year instead of just the last month, but I put 12 by hand I'm missing the results for the latest year.