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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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.

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may use Variables in DAX.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may use Variables in DAX.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks, that worked like a charm

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.