Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello everyone,
How do I set a default selected value on the segment?
example:
today is 10/18/2023 (dd/mm/yyyy), I want the default selected date to be 10/01/2023 to 10/18/2023. and the user can modify this segment value without modifying the filters.
Can anybody help me ?
Thanks
best regards
Solved! Go to Solution.
Hi @randomUser21 ,
For the slicer that comes with Power BI, we can not get it. But we can get the three point in the "Visualizations", and we click the "Get more visual":
Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.
Here are the steps you can follow:
1. First , we need to create a table with one column , and the value is True and False, like this
2. Second , we can create a measure to define which the date we need to default preselected. If we need to default preselect then we return True else return False.
Flag =
var _date=
SELECTEDVALUE('Table'[Date])
var _today=TODAY()
var _min_date=
DATE(YEAR(_today),MONTH(_today),1)
return
IF(
_date >= _min_date && _date<= _today,TRUE(),FALSE())
3. Then we can put the 'Table'[Date] in the Fields , [Flag] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @randomUser21 ,
For the slicer that comes with Power BI, we can not get it. But we can get the three point in the "Visualizations", and we click the "Get more visual":
Then we find the "Preselected Slicer" and add the visual to our Power Bi Desktop.
Here are the steps you can follow:
1. First , we need to create a table with one column , and the value is True and False, like this
2. Second , we can create a measure to define which the date we need to default preselected. If we need to default preselect then we return True else return False.
Flag =
var _date=
SELECTEDVALUE('Table'[Date])
var _today=TODAY()
var _min_date=
DATE(YEAR(_today),MONTH(_today),1)
return
IF(
_date >= _min_date && _date<= _today,TRUE(),FALSE())
3. Then we can put the 'Table'[Date] in the Fields , [Flag] in the Pre Selection , 'Dirty Table'[Dirty Status] in the Dirty Status, like below screenshot:
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
@Anonymous Thank you for your answer ,
this is not possible on the calendar segment?
I tried your solution it works well but this form will not suit my users they would have needed a calendar.