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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
orlandopowerbi
Frequent Visitor

SHOWING n last weeks of data from the MAX date filtered

Hello everyone,

 

I'm trying to display the last 4 weeks of data. In my report i have 3 date slicers for year, month and date.

 

So what i would like is that whichever date filter is applied, my visual takes the maximum date filtered and display 4 weeks back of data from that maximum, ignoring whatever month filter is applied. To be more specific, if the user filters for March, i would like to display 4 weeks back, that includes February, instead of only March numbers.

 

So far I've tried this:

 

I created a measure which calculates the maximum date.

 

Max Date = CALCULATE(MAX(Data[Date]))

 

Then, i edited the interactions so mi visual is not affected by any date slicer and create a measure like these:

 

Calls = 
VAR MAXDATE = [Max Date]
VAR MINDATE = [Max Date]-28
RETURN CALCULATE(SUM(Data[Inbound]),FILTER(Dates,(Dates[Date]<=MAXDATE && Dates[Date]>=MINDATE)))

 

So in my head, the measure would capture the Maximum date filtered so my Calls measure can retrieve only the desired data.

 

But my visual is ingoring the filter condition and diplaying everything as unfiltered.

 

Thank you very much in advance for any help or ideas provided.

 

 

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@orlandopowerbi , Seem correct at first look.

 

Try if this one can help

 

Calls =
VAR MAXDATE = MAXX(allselected(Data), Data[Date])
VAR MINDATE = [Max Date]-28
RETURN CALCULATE(SUM(Data[Inbound]),FILTER(Dates,(Dates[Date]<=MAXDATE && Dates[Date]>=MINDATE)))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you @amitchandak , but the result seems to do the same. The visual is not reacting at all to the date slicers.

 

The weird thing is that that MAXX(allselected(Data), Data[Date]) does get the desired date but its doesnt seem to work inside the filter. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.