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

Date slicer value capturing and using in filtering data

Hi,

 

We have four date columns and we need to compare the date selected from the date slicer with these four columns and then create the visuals which will  filter accordingly.

 

E.g I have four date fields Date1,Date2,Date3 and Date4. If a user select Date from Calendar table, the report and visuals should get filtered on following condition:

 

Date 1 <= <SelectedDate> AND

Date 2 >= <SelectedDate> AND

Date 3 <= <SelectedDate> AND

Date 4 >= <SelectedDate> 

 

I am able to capture the date selection using ALLSELECTED function but unable to use the selected value in creating a calculated column that can help in filtering the dataset and visuals.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

Add below measure into "Visual level filter" and set its value to 1.

check =
IF (
    MAX ( [Date1] ) <= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date2] ) >= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date3] ) <= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date4] ) >= SELECTEDVALUE ( 'calendar'[Date] ),
    1,
    0
)

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @Anonymous ,

 

Add below measure into "Visual level filter" and set its value to 1.

check =
IF (
    MAX ( [Date1] ) <= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date2] ) >= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date3] ) <= SELECTEDVALUE ( 'calendar'[Date] )
        && MAX ( [Date4] ) >= SELECTEDVALUE ( 'calendar'[Date] ),
    1,
    0
)

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thankyou for the above solution. It works fine when we are dragging those date columns into the visual. But we want the count of other columns as well with the date filtered in different visuals where we do not wish to drag the 4 date columns. Suppose I drag a dimension and measure from dataset, apply this measure filter and create a visual like bar chart/line chart etc. then no data appear on the visual and the visual goes blank. Could you help me?

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.