Forum Discussion
Date between slicer - Change order
- 5 months ago
Hi PowerBILeaner26 ,
Thank you for the response.The reverse index approach works functionally, but you’re right, it doesn’t show the actual date range to the user.
A common workaround is to keep the reverse index slicer and add a dynamic measure to display the selected date range in a Card visual.
1. Create measures
Selected Start Date =
CALCULATE(
MAX('Date'[Date]),
FILTER(ALL('Date'),
'Date'[ReverseIndex] = MIN('Date'[ReverseIndex])
))
Selected End Date =
CALCULATE(
MIN('Date'[Date]),
FILTER(ALL('Date'),
'Date'[ReverseIndex] = MAX('Date'[ReverseIndex])
))2. Create display measure
Selected Date Range =
"From: " & FORMAT([Selected Start Date], "dd MMM yyyy") &
" To: " & FORMAT([Selected End Date], "dd MMM yyyy")3. Add to report
Keep using ReverseIndex slicer
Add a Card visual
Use Selected Date RangeThis way users can still control the slider (latest to oldest) while clearly seeing:
“From: [Start Date] To: [End Date]”
Hope this helps.Thank you
Hi PowerBILeaner26 ,
The Between date slicer direction cannot be reversed in Power BI. Sorting or ranking columns does not change the slider order. You can try this workaround to simulate a reverse (latest to oldest) slider in Power BI. The trick is to not use a Date slicer at all, but instead use a numeric index that represents dates in reverse order.
1) Create Reverse Index Column
For example:
latest date = smallest index
ReverseIndex = RANKX(
ALL('Date'[Date]),
'Date'[Date],,
DESC,
DENSE)
Date - ReverseIndex
25 Feb - 1
24 Feb - 2
23 Feb - 3
2) Create a slider using ReverseIndex
3)Create a Measure to Filter Dates:
Selected Date Range =
VAR MinIndex =
MIN('Date'[ReverseIndex])
VAR MaxIndex =
MAX('Date'[ReverseIndex])
RETURN
IF(
SELECTEDVALUE('Date'[ReverseIndex]) >= MinIndex &&
SELECTEDVALUE('Date'[ReverseIndex]) <= MaxIndex,
1)
4) Apply Visual Filter
Add this measure to each chart.
Visual filter > Selected Date Range = 1
Power BI cannot reverse the Date range slicer, but it can reverse numeric indexes. By mapping dates to numbers, you gain control over the slider direction.
Hope this helps.
Thank you.
Hello v-echaithra,
Thank you for the workaround steps and it's working with the reverse index number.
But the end user looking with the date information in the slider so that either the end user can drag left to right (or) enter the date (start or end) to achieve the date range. The reverse index is working good but not sure about what date range selected.
Anyway thanks for the help. Much appreciated! For now, I will go with reverse index slider. Thank you!
- v-echaithra5 months ago
Community Support
Hi PowerBILeaner26 ,
Thank you for the response.The reverse index approach works functionally, but you’re right, it doesn’t show the actual date range to the user.
A common workaround is to keep the reverse index slicer and add a dynamic measure to display the selected date range in a Card visual.
1. Create measures
Selected Start Date =
CALCULATE(
MAX('Date'[Date]),
FILTER(ALL('Date'),
'Date'[ReverseIndex] = MIN('Date'[ReverseIndex])
))
Selected End Date =
CALCULATE(
MIN('Date'[Date]),
FILTER(ALL('Date'),
'Date'[ReverseIndex] = MAX('Date'[ReverseIndex])
))2. Create display measure
Selected Date Range =
"From: " & FORMAT([Selected Start Date], "dd MMM yyyy") &
" To: " & FORMAT([Selected End Date], "dd MMM yyyy")3. Add to report
Keep using ReverseIndex slicer
Add a Card visual
Use Selected Date RangeThis way users can still control the slider (latest to oldest) while clearly seeing:
“From: [Start Date] To: [End Date]”
Hope this helps.Thank you
- PowerBILeaner265 months agoRegular Visitor
Hello v-echaithra,
Thank you very much for workaround solution. It works perfectly. Much appreciated. Thanks agian!
Thanks.