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

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.

Reply
Anonymous
Not applicable

Measure to affect Date Slicer

Hi BI Community,

 

I would like to ask wheather I select a date from dropdown filter it affects two other slicers.

What I mean. My report is run every monday on excel and want to move it to PBI.
Inside Workers table there is Candidate_ID, Start_date, End_Date.

I would like to select ex. 8-Nov-2021 on one dropdown filter and it will limit Start_date before 8-Nov-2021 and all End_Date after 8-Nov-2021.

Curently there are two slicers but I would like to merge it into one dropdown list.

 

Based what I found in interenet I tried to creat second dates table, two way filtering, a measure (like below) based on selected date but with no success. 

DateSelected = SELECTEDVALUE(DatesTbl[Date])

and later create a column in dataset, but it doesn't work as well.

WorkerFlag =

IF (

'Workers'[Start_date] < DatesTbl[DateSelected],
IF ( 'Workers'[End_date] >= DatesTbl[DateSelected], 1, 0 ),
0

)power_bi_issue.jpg

 

I would be thankful if there is a solution for this.

Pawel

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous

You need to create a measure rather than a calculated column.

Visual filter(WorkerFlag) = 
IF (
    SELECTEDVALUE ( Workers[Start_date] ) < SELECTEDVALUE ( DatesTbl[Date] )
        && SELECTEDVALUE ( Workers[End_Date] ) >= SELECTEDVALUE ( DatesTbl[Date] ),
    1,
    0
)

Then apply this new meaure to 'filters on this visual' of viusal filter pane.

13.png

Count_ID = 
VAR tab =
    FILTER (
        Workers,
        Workers[Start_date] < SELECTEDVALUE ( DatesTbl[Date] )
            && Workers[End_Date] >= SELECTEDVALUE ( DatesTbl[Date] )
    )
RETURN
    CALCULATE ( DISTINCTCOUNT ( Workers[Calendar_ID] ), tab )

Please check my sample file for more details.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous

You need to create a measure rather than a calculated column.

Visual filter(WorkerFlag) = 
IF (
    SELECTEDVALUE ( Workers[Start_date] ) < SELECTEDVALUE ( DatesTbl[Date] )
        && SELECTEDVALUE ( Workers[End_Date] ) >= SELECTEDVALUE ( DatesTbl[Date] ),
    1,
    0
)

Then apply this new meaure to 'filters on this visual' of viusal filter pane.

13.png

Count_ID = 
VAR tab =
    FILTER (
        Workers,
        Workers[Start_date] < SELECTEDVALUE ( DatesTbl[Date] )
            && Workers[End_Date] >= SELECTEDVALUE ( DatesTbl[Date] )
    )
RETURN
    CALCULATE ( DISTINCTCOUNT ( Workers[Calendar_ID] ), tab )

Please check my sample file for more details.

 

Best Regards,
Community Support Team _ Eason

amitchandak
Super User
Super User

@Anonymous , I doubt that is possible in the case of a range slicer. Limit the start or end date is not possible 

You can log an idea

https://ideas.powerbi.com/ideas/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.