Forum Discussion
Get latest day data when report is loaded
- 1 year ago
Solution: Use a Dynamic Relative Date Slicer alongside a Static Range Slicer
Since you want to stick to a range slicer, which retains the visual look (as shown in your image), we can set a workaround using dynamic filters or DAX measures to ensure the latest date is always selected initially.
Steps:
Create a Dynamic Date Measure:
- First, create a measure that dynamically calculates the latest date in your dataset.
- Go to Modeling and select New Measure. Use the following DAX formula:
DAXCopy codeLatestDate = MAX(YourDateTable[Date])This measure will return the most recent date in your data.
Add a Filter Based on Latest Date:
- In your report, you’ll keep your range slicer. To ensure the default shows the latest data, do the following:
- Add a page-level filter using this new LatestDate measure, and set it to the latest date. This will filter the page to always show the latest date by default, while allowing the user to adjust the range on the slicer afterward.
- In your report, you’ll keep your range slicer. To ensure the default shows the latest data, do the following:
Optional: Using a Bookmark for Default View:
- After setting the slicer to your desired default state (i.e., with the date range starting from the latest date), create a Bookmark:
- Go to View > Bookmarks and create a new one.
- Set the bookmark as the default view. When users reopen the report or refresh the page, it will reset to this bookmark, displaying the most recent date.
- After setting the slicer to your desired default state (i.e., with the date range starting from the latest date), create a Bookmark:
Publish to Power BI Service:
- Once published, whenever the data is refreshed daily, the report will default to showing the latest date range without affecting the slicer appearance.
Solution: Use a Dynamic Relative Date Slicer alongside a Static Range Slicer
Since you want to stick to a range slicer, which retains the visual look (as shown in your image), we can set a workaround using dynamic filters or DAX measures to ensure the latest date is always selected initially.
Steps:
Create a Dynamic Date Measure:
- First, create a measure that dynamically calculates the latest date in your dataset.
- Go to Modeling and select New Measure. Use the following DAX formula:
DAXCopy codeLatestDate = MAX(YourDateTable[Date])This measure will return the most recent date in your data.
Add a Filter Based on Latest Date:
- In your report, you’ll keep your range slicer. To ensure the default shows the latest data, do the following:
- Add a page-level filter using this new LatestDate measure, and set it to the latest date. This will filter the page to always show the latest date by default, while allowing the user to adjust the range on the slicer afterward.
- In your report, you’ll keep your range slicer. To ensure the default shows the latest data, do the following:
Optional: Using a Bookmark for Default View:
- After setting the slicer to your desired default state (i.e., with the date range starting from the latest date), create a Bookmark:
- Go to View > Bookmarks and create a new one.
- Set the bookmark as the default view. When users reopen the report or refresh the page, it will reset to this bookmark, displaying the most recent date.
- After setting the slicer to your desired default state (i.e., with the date range starting from the latest date), create a Bookmark:
Publish to Power BI Service:
- Once published, whenever the data is refreshed daily, the report will default to showing the latest date range without affecting the slicer appearance.