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.
Thanks DataNinja777 , The only problem I see with this is when I change the date then it doesn't stick.
Like here I have selected this options, Now I change dates to last 10 days and it display correctly,
Now if I change the date option here,
It displays all the available dates when I change the date options even though I have selected last 10 days. Is there any workaround to this?
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.