Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
My Power BI report feeds off of one table which has, among other fields:
TimeStamp
Reading
I use a line chart to plot Reading values over time -- so TimeStamp is on the x axis.
Since there's a lot of history, users are requesting some shortcut options:
(_) Last 7 days
(_) Last 30 days
(_) Last 90 days
(_) All time
Ideally these option would show up in a single-select slicer. When selected, the data set and visual would filter down to the date range selected.
I was able to easily implement one such option by adding this measure to my table:
Last7Days =
VAR _max = MAX(Table1[TimeStamp])
RETURN IF((Table1[TimeStamp] > _max - 7) && Table1[TimeStamp] <= _max, "Last 7 Days")
I can put that in a slicer by itself and when the user clicks the checkbox, the visual filters to show just the last 7 days.
How can I implement more such options and make them mutually exclusive?
@bvy You can create a parameter table that has two columns:
* the text labels (ie "Last 7 days")
* the days to filter (ie Today -7)
Then follow a similar method to this: https://excelwithallison.blogspot.com/2021/08/categorical-date-slicer-in-power-bi.html
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
58 | |
55 | |
55 | |
36 | |
30 |
User | Count |
---|---|
79 | |
66 | |
45 | |
44 | |
42 |