Forum Discussion
Date Picker slicer with relative date
- Anonymous1 year ago
Thanks for the reply from DataNinja777 and MiquelPBI , please allow me to provide another insight:
Hi, george1
Based on my testing, parameters cannot be converted to the relative time type in a slicer. Therefore, your slicer must be derived from one of the columns in your data table. This is likely why you are encountering errors, as one of your slicers is derived from parameters, while the relative time type is from a fixed column.
I have provided an alternative solution for you:
1.Firstly, create the following measure:
MEASURE = VAR diff = 10 VAR selectid = MAX ( 'Parameter'[Parameter Order] ) VAR column1d = CALCULATE ( MAX ( 'Table'[Column1] ), ALLSELECTED ( 'Table' ) ) VAR column2d = CALCULATE ( MAX ( 'Table'[Column2] ), ALLSELECTED ( 'Table' ) ) RETURN SWITCH ( TRUE (), selectid = 0, IF ( MAX ( 'Table'[Column1] ) >= column1d - diff, 1, 0 ), selectid = 1, IF ( MAX ( 'Table'[Column2] ) >= column2d - diff, 1, 0 ), 1 )2.Secondly, apply the measure to the visual object:
3.Here's my final result, which I hope meets your requirements.
Please find the attached pbix relevant to the case.
Of course, if you have any new ideas, you are welcome to contact us.
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi DataNinja777 , this looks very interesting. I have a couple of questions:
1) In your code you mentioned create disconnected date table, with below function:
DateTable = CALENDAR(MIN('YourTable'[Encounter Date]), MAX('YourTable'[Coded Date]))Why do I need to take only this two fields from the date? Because sometimes Coded Date as max available value and sometimes Date of Service has max value. Then why do I need to take only this two in the mix?
2) I do have many measures, like 7 or 8 measures. So do I need to create this kind (SelectedDateMeasure) for 7 or 8 times?
And also do you have pbix file and if you can attach it here then I can have a look at the reference as well. This will help.