Hi,
I was wondering if it's possible catch slice selected dates and then save it to a VARIABLE/PARAMETER which will be used to filter a DATE field in a table.
Can I do that?
Hi @jr3151006 ,
Slicer works on visual level, it will not filter the underlying data. You could create a query parameter and use it to filter data when you loading data.
https://docs.microsoft.com/en-us/power-query/power-query-query-parameters
Similar question refer:
https://community.powerbi.com/t5/Desktop/power-bi-pass-slicer-value-as-query-parameter/td-p/2189511
Best Regards
Lucien
🙄👌
Hi @jr3151006 ,
I'm sorry if I misunderstood your intentions at first, but you can check if this sample below is what you are looking for.
Base data.
When the slicer selects 1, the type car corresponding to 1 is passed to the filter, which then filters out all data whose type is car.
Solution:
create a slicer table:
Then use the below measure:
Measure =
VAR selectedids = VALUES('ID For Slicer'[ID])
VAR myType=CALCULATETABLE(VALUES(Table1[Type]),Filter(all(Table1),Table1[ID] in selectedids))
RETURN
if(VALUES(Table1[Type]) in myType,"Yes","N0")
Apply to filter:
Best Regards
Lucien
@jr3151006 You can do it inside a measure but unfortunately a measure cannot return a non-scalar value. So your measure would have to be something like:
Measure =
VAR __Dates = 'Dates'[Date]
<do some stuff>
RETURN
<something>