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
connork
Helper I
Helper I

Filtering Matrix with Calculated Measure

I have a calculated measure MFILTER that is a max date to filter out data after the desired reporting range in the table DATA.  The DATA table that has the following fields: 

EmployeeClientDateMonthEndQty

 

The following measure is being used in table to show prior month quantity by dept & employee in a matrix:

 

PMTotal = 
VAR 
PM = eomonth([MFILTER],-1)
VAR 
CY = year([MFILTER])
RETURN
calculate(sum(DATA[QTY]),
	filter(DATA,
		DATA[monthend]= PM
		&&year(DATA[monthend])=CY
	)
)

 

The measure is correct for active employees with hours, but if there was an employee in the dept with old records PMTotal is populating with a sum of the last records that employee has (i.e. ignoring the filter).

 

If I change the last part of the code to:

   Year(DATA[MonthEnd]) = CY year(today())

The filter works and the employees with old data are excluded.

 

Any help/input on why the year filter is not working when referencing the VAR CY is appreciated.

 

1 REPLY 1
v-yuezhe-msft
Employee
Employee

@connork,

What formula do you use to create MFILTER measure? Could you please share sample data of your table and post expected result here ?

Regards,
Lydia Zhang

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

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.