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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Colinr
New Member

Help to convert hard coded Dax filter to use current selection values

I have a Dax filter that correctly filters to hard coded values, How can I change this to use the Filters of the current PBI visualisation page filter selection, Id also like the Date to use the  SAMEPERIODLASTYEAR() for the date filter ?

 What I have so far is :

 

 

previousYear = CALCULATE (
SUM ( 'vw Monthly Milk Production'[value] ),
FILTER (
All('vw Monthly Milk Production'),
'vw Monthly Milk Production'[adjustment] == "30 Day adjustment"
&& 'vw Monthly Milk Production'[Type] == "Natural Content"
&& 'vw Monthly Milk Production'[country] == "United Kingdom"
&& 'vw Monthly Milk Production'[date] == value("2020-02-01")
)
)

 

 

1 REPLY 1
Colinr
New Member

Ive got a bit further with below, but the sameperiod last year function, returns an empty filed in my pbi table,  What Do I need to do to provide this expression with the correct context please ?

 

 

 

previousYear = CALCULATE (
SUM ( 'vw Monthly Milk Production'[value] ),
FILTER (
ALLSELECTED('vw Monthly Milk Production'),
'vw Monthly Milk Production'[date] == SAMEPERIODLASTYEAR(Dates[Date].[Date])
)
)

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.