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
TMQ
Regular Visitor

Can I set page filters for "last 7 days"?

Hi, I have a report that has multiple pages, one for each customer.  On each page is 7 graphs, showing their activity for each of the last 7 days.

 

When I refresh the data, is there a very clever way to have the graphs update so they show the most recent data..... i.e. yesterday, the day before, the day before, etc..

 

 

At the moment I have to change the date on each graph on the page, and then on every page for each customer.

Thanks.

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@TMQ - Generally, the technique to handle this is to create a custom column that is basically:

 

DaysOld = TODAY() - [Date]

Then, you just set your filter to DaysOld "less than x", in your case 7.

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

9 REPLIES 9
eagletro
Frequent Visitor

Hi All,

 

I had a requirement to view tickets NOT updated (used column updateddate) in the last 7 days so i used power query for the below to create a custom column named UpdatedLast7Days.

 

if([Updateddate] < Date.AddDays(DateTime.Date(DateTime.LocalNow()),-7)) then true else false.

 

I then added a page level filter of the custom column i created called UpdatedLast7Daysand selected True only to show Tickets not updated in the last 7 days. Also the timeline visual is nice to add the updated date into the report, that way you can drill drown on the departments that are bad offenders. 🙂

Greg_Deckler
Super User
Super User

@TMQ - Generally, the technique to handle this is to create a custom column that is basically:

 

DaysOld = TODAY() - [Date]

Then, you just set your filter to DaysOld "less than x", in your case 7.

 

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler

 

I want to have a slicer for Yesterday, Last Week and Last 30 Days. Below is my IF statement. However, the Last Week does not include Yesterday and Last 30 Days does not include Last Week. Can you help me fix this, please.

 

DatePeriod =
IF(INT(TODAY() - DimDate[Date]) =1, "Yesterday",
IF(INT(TODAY() - DimDate[Date]) < 7, "Last 7 Days",
IF(INT(TODAY() - DimDate[Date]) < 30, "Last 30 days", "Date Range")))

 

Thanks;

Andrew

 

@AndrewDang Did you find any solution for this ? I am facing the same issue 

Hey good morning,

Quick question, I seem to be getting an error with what seems to be a very straight forward calculation:

 

mispelled.PNG 

 

I had been handling this previously by making a second query using a date filter but would love to figure out how to just do it with a calcualted column. 

 

Thank you!

 

 

 

 

I was able to resolve this using what appears to be a new "Age" function built into Power BI. I duplicated by date column, converted it to Age via the date menu,. and then changed it to a whole number (it was calculating minutes initially I think). 

 

Hi,

 

I din't get that.

So, I created two attributes one has the current date and the other has Current_Date-7 value.

 

So when I put this in visual filter it is asking me to select the dates from the calendar.

 

I'm missing what you said about you just set your filter to DaysOld .

@Greg_Deckler Oh gosh, that's much easier

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂
austinsense
Impactful Individual
Impactful Individual

Calculated Column on the Date Table

 

7DayFlag = IF(NOW() - Date[Date] <= 7 && Date[Date] <= NOW(), 1, 0)

 

 

Then you set the report filter on this field to 1 and it will update every time the report updates with the most recent 7 days.  You can replicate the same logic for different windows of time.

Austin is VP Operations at PowerPivotPro and a professional self-service enthusiast 🙂

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