Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have a date slicer I am using a date heirarchy in. My goal is to select a month-year combo in the slicer and then have one visual filter to that specific selection and another visual filter to the relevant quarter associated with the selected month. I'm struggling to work out a way to use a single date slicer to filter on different date parts in different visuls.
Any ideas out there?
Solved! Go to Solution.
Hi @jvolden ,
Sorry for my late reply firstly.
You could follow these steps below to achieve your needs.
1.Extract the Date column to create a single table for slicer:
ForSlicer =
SELECTCOLUMNS ( 'Table', "Date", [Date] )
2.Use the following formula to create measure and apply it to filter pane ,set as "is 1" for visual1
for YearMonth =
VAR _seleYear =
SELECTEDVALUE ( 'ForSlicer'[Date].[Year] )
VAR _seleMonth =
SELECTEDVALUE ( 'ForSlicer'[Date].[MonthNo] )
RETURN
IF (
YEAR ( MAX ( 'Table'[Date] ) ) = _seleYear
&& MONTH ( MAX ( 'Table'[Date] ) ) = _seleMonth,
1,
0
)
3. Almost the same as step2 for visual2
for Quarter =
VAR _seleYear =
SELECTEDVALUE ( 'ForSlicer'[Date].[Year] )
VAR _seleMonth =
SELECTEDVALUE ( 'ForSlicer'[Date].[MonthNo] )
VAR _quar =
MAXX (
FILTER ( ALL ( 'Table' ), 'Table'[Date].[MonthNo] = _seleMonth ),
QUARTER ( [Date] )
)
RETURN
IF (
YEAR ( MAX ( 'Table'[Date] ) ) = _seleYear
&& QUARTER ( MAX ( 'Table'[Date] ) ) = _quar,
1,
0
)
The final output is shown below:
Please kindly take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jvolden ,
Sorry for my late reply firstly.
You could follow these steps below to achieve your needs.
1.Extract the Date column to create a single table for slicer:
ForSlicer =
SELECTCOLUMNS ( 'Table', "Date", [Date] )
2.Use the following formula to create measure and apply it to filter pane ,set as "is 1" for visual1
for YearMonth =
VAR _seleYear =
SELECTEDVALUE ( 'ForSlicer'[Date].[Year] )
VAR _seleMonth =
SELECTEDVALUE ( 'ForSlicer'[Date].[MonthNo] )
RETURN
IF (
YEAR ( MAX ( 'Table'[Date] ) ) = _seleYear
&& MONTH ( MAX ( 'Table'[Date] ) ) = _seleMonth,
1,
0
)
3. Almost the same as step2 for visual2
for Quarter =
VAR _seleYear =
SELECTEDVALUE ( 'ForSlicer'[Date].[Year] )
VAR _seleMonth =
SELECTEDVALUE ( 'ForSlicer'[Date].[MonthNo] )
VAR _quar =
MAXX (
FILTER ( ALL ( 'Table' ), 'Table'[Date].[MonthNo] = _seleMonth ),
QUARTER ( [Date] )
)
RETURN
IF (
YEAR ( MAX ( 'Table'[Date] ) ) = _seleYear
&& QUARTER ( MAX ( 'Table'[Date] ) ) = _quar,
1,
0
)
The final output is shown below:
Please kindly take a look at the pbix file here.
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jvolden
Create 2 different slicers one for month and one for year, then use the "Edit interactions" feature of the desktop to Stop and Filter the visuals as you like.
Regards
Amine Jerbi
If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
110 | |
91 | |
84 | |
66 |