Forum Discussion
Dynamically changing Date slicer
- 8 years ago
I think you can try to use Power Query to create a new table which is containing today and 7 days before today. Then use this table value as slicer.
Please refer:
1. Go to Edit Queries, create a new blank query with Power Query script:
= {Date.AddDays(Date.From(DateTime.LocalNow()),-7),Date.From(DateTime.LocalNow())}2. Change List to Table. Then you can get the dynamica today and 7 days before today.
Thanks,
Xi Jin.
Thanks for the reply MFleix - I tried that. The problem is because my visual is a table of customers, where I'm showing sales for the date and the same date the prior year, when I use relative filtering and change the option to the last 7 days, then what I get is the last 7 days of sales for every customers (and their sales for those same 7 days last year). So I'm trying to get the slicer to automatically pick Feb 6 for today (Feb13). Then tomorrow (Feb14) the slicer defaults to Feb 7, etc
I think you can try to use Power Query to create a new table which is containing today and 7 days before today. Then use this table value as slicer.
Please refer:
1. Go to Edit Queries, create a new blank query with Power Query script:
= {Date.AddDays(Date.From(DateTime.LocalNow()),-7),Date.From(DateTime.LocalNow())}2. Change List to Table. Then you can get the dynamica today and 7 days before today.
Thanks,
Xi Jin.