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

Filter with dynamic lookup on today()

Hi all,

 

I'm looking to do a page level filter to only show values for my time period lets call it "Winter", I have linked a dimensions table with every date in the year and what period they fall into, so I would like to be able to say if we're currently in the winter period then show me all values filtered by winter, and if today() equals summer then show all values on summer.

 

I created a lookup formula within a measure where CurrentPeriod = LOOKUPVALUE(DimDate[Period],DimDate[Date],Today()) but I cant drag that over to the page level filters and when dragged over to the visual level filters, I'm not sure how to set the filter to be dynamic?

 

Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@JDro , Create a new column like this in your table and select current

if([period] = maxx(filter(Table,[Date]=today()),[period]), "Current", [period])

View solution in original post

3 REPLIES 3
westwrightj
Resolver III
Resolver III

@JDro 

 

I think I might know what you are trying to do here. I don't have an elegant solution but this would ultiamtely work to meet the need I think

 

So I've made some sample data to start with for a dimension table

 

westwrightj_0-1605197132311.png

 

One thing you could do is first make a column to identify what season today falls into

 

 

Today Column = 

var TheDay_Today = TODAY()

return

IF(DimTable[Date] = TheDay_Today, DimTable[Season], "")

 

Which will give you something like this

 

Capture.JPG

 

Next you can make a column to only fill in seasons for when the Season matches the Today Column

 

Current Season = 

var TheMaxSeason_Today = CALCULATE(MAX(DimTable[Today Column]), ALL(DimTable))

return

IF(DimTable[Season] = TheMaxSeason_Today, 1, 0)

 

That will give you a binary column you can then use to reference as page level filter or within measures

 

Capture.JPG

 

That would allow the page level filtering to work and update as you shift through seasons

 

 

Capture.JPG

amitchandak
Super User
Super User

@JDro , Create a new column like this in your table and select current

if([period] = maxx(filter(Table,[Date]=today()),[period]), "Current", [period])

Thank you! This worked perfectly.

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.

Top Solution Authors