Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
I've been watching this tutorial on how to make a preset value button panel for certain date ranges
https://www.youtube.com/watch?v=nocsNBF_NkE
The Sample File is here: https://github.com/MarkWilcock/lbag-online/tree/master/M%26G%20Results
I've succesfully implemented it, but I'm having trouble synchronizing the Preset Value Panel with the Date Slicer.
I want to give my team the chance to get a fast last 3-6-12 months range experience, but I also want to give them the ability to choose a range of 3 months from the past for example.
The solution I have so far is to place the between date at first date / last date so it doesn't filter anything... but when you choose the last 3-6-12 months in the preset value it doesn't show as well in the slicer, which may be confusing to see. For example:
Any ideas?
Thank you very much for your support!
Solved! Go to Solution.
Hi @Caesarul ,
I created some data:
You can use the Switch() function to determine that the slicer is an option and the date is in a certain interval, so you can display it and add the value.
Here are the steps you can follow:
1. Create measure.
Flag =
var _today=TODAY()
var _1m=DATE(YEAR(_today),MONTH(_today)-1,DAY(_today))
var _3m=DATE(YEAR(_today),MONTH(_today)-3,DAY(_today))
var _6m=DATE(YEAR(_today),MONTH(_today)-6,DAY(_today))
var _1y=DATE(YEAR(_today)-1,MONTH(_today),DAY(_today))
var _ytd=DATE(YEAR(_today),1,1)
var _maxdate=MAXX(ALL('Table'),'Table'[Date])
return
SWITCH(
TRUE(),
MAX('Preset'[Preset Code]) = "1M"&&MAX('Table'[Date])>=_1m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "3M"&&MAX('Table'[Date])>=_3m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "6M"&&MAX('Table'[Date])>=_6m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "1Y"&&MAX('Table'[Date])>=_1y &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "YTD"&&MAX('Table'[Date])>=_ytd &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "Max"&&MAX('Table'[Date])=_maxdate,1,0)
Value =
SUMX(ALLSELECTED('Table'),[Rand])
2. Place [Flag]in Filters, set is=1, apply filter.
3. 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
Thank you for investing the time into this. It works perfectly!
But my challenge is to sync the Date Between slicer with the Preset Code.
Here's a screenshot of what I mean. The date in table is filtered correctly, but the slicer still remains untouched... 😞
Hi @Caesarul ,
I created some data:
You can use the Switch() function to determine that the slicer is an option and the date is in a certain interval, so you can display it and add the value.
Here are the steps you can follow:
1. Create measure.
Flag =
var _today=TODAY()
var _1m=DATE(YEAR(_today),MONTH(_today)-1,DAY(_today))
var _3m=DATE(YEAR(_today),MONTH(_today)-3,DAY(_today))
var _6m=DATE(YEAR(_today),MONTH(_today)-6,DAY(_today))
var _1y=DATE(YEAR(_today)-1,MONTH(_today),DAY(_today))
var _ytd=DATE(YEAR(_today),1,1)
var _maxdate=MAXX(ALL('Table'),'Table'[Date])
return
SWITCH(
TRUE(),
MAX('Preset'[Preset Code]) = "1M"&&MAX('Table'[Date])>=_1m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "3M"&&MAX('Table'[Date])>=_3m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "6M"&&MAX('Table'[Date])>=_6m &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "1Y"&&MAX('Table'[Date])>=_1y &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "YTD"&&MAX('Table'[Date])>=_ytd &&MAX('Table'[Date])<=_today,1,
MAX('Preset'[Preset Code]) = "Max"&&MAX('Table'[Date])=_maxdate,1,0)
Value =
SUMX(ALLSELECTED('Table'),[Rand])
2. Place [Flag]in Filters, set is=1, apply filter.
3. 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