Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply

Trying to filter a slicer between dates with a measure

Hi guys, I’m strugluling to find a solution, but I need your help:

 

In my report, I have a table just to filter _Years. It’s a really simple table with one column that goes from 2021 to 2024.

This table is not related to any other table, because I need to relate and filter information from different tables that uses different parameters of years. I use it to create a main slicer that filter those years. So, I can’t relate this table.

I have some pages that use this main slicer and uses a Slicer BETWEEN DATES to filter days, months of year.

 

The issue is:

 

In the Slicer Between, I’m trying to show just the dates in the year in question.

For example, if I’m trying to search information of 2022, the Slicer Between shows me that is possible to filter information from 2019 to 2024, even if there is no information to show (because the main filter works fine).

I created a measure do help the main filter that works well at the appointment table:

ScheduleStartYear =

VAR MinValue = YEAR(MIN(appointments[scheduledstart]))

VAR MaxValue = YEAR(MAX(appointments[scheduledstart]))

VAR AtualValue = [YEAR_CR]

 

RETURN IF(AtualValue >= MinValue && AtualValue <= MaxValue, 1, 0)

 

And the measure YEAR_CR is:

YEAR_CR =

IF(

 ISBLANK( SELECTEDVALUE(_years[year]) ),

 YEAR(TODAY()),

 SELECTEDVALUE(_years[year])-1)

 

IIf I try to filter the table, it works fine.

 

I use the ScheduleStartYear at the table, on filter pane, to help the main slicer to filter the information of the year,

But when I try to put this measure at the Slicer Between Dates (that also uses appointments[scheduledstart]), it doesn’t work well. It just show the dates from this year.

First, I tried to change the YEAR_CR just to SELECTEDVALUE(_years[year])-1, but I fail.

It just work when I change the measure to 2022 or just the AtualValue in ScheduleStartYear to 2022.

Every else works fine with these measures but Slicer Between Dates. Is not possible to filter this slicer?

0 REPLIES 0

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.