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
mohsabbah
Frequent Visitor

Dates Dropdown slicer to filter from the start date up to the selected date

Hello Volks,

I have a dates table, every row represent the enddate of a week from the porject beggining 
dates table.jpg

I'm using slicer to choose the period from the beggining to specific date from this column.
slicer.png

I had been asked to change it to dropdown list as my manager is confused what to choose from the slicer.
I tried to convert it to dropdown but when i choose a date it filter only the chosen date data, and we want it to filter a period from the project start to the selected date.
dropdown.png

I would be thankful for any help to modify the slicer to filter a period instead of filter only the chosen date.

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

Hi @mohsabbah ,

 

You can use the slicer and sifter together.

1. Create a new table for the slicer.

 

 

Table for slicer = VALUES('Calendar'[Date])

 

vcgaomsft_0-1661825549355.png

2. New a mesure.

 

Filter = 
VAR _selectdate =
    SELECTEDVALUE ( 'Table for slicer'[Date] )
VAR _filter =
    IF ( MAX ( 'Calendar'[Date] ) <= _selectdate, 1 )
RETURN
    _filter

 

3.1 For visual that have a date field, you can use this measure for the filter.

vcgaomsft_1-1661825686771.png

Result.

vcgaomsft_2-1661825726297.png

3.2 For visual like cards, you need to modify the filtering parameters in the formula.

Total = 
SUM ( 'FactSalesTable'[Sales] )
Total = 
CALCULATE (
    SUM ( 'FactSalesTable'[Sales] ),
    FILTER (
        'Calendar',
        'Calendar'[Date] <= SELECTEDVALUE ( 'Table for slicer'[Date] )
    )
)

vcgaomsft_3-1661826509882.png

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

4 REPLIES 4
v-cgao-msft
Community Support
Community Support

Hi @mohsabbah ,

 

You can use the slicer and sifter together.

1. Create a new table for the slicer.

 

 

Table for slicer = VALUES('Calendar'[Date])

 

vcgaomsft_0-1661825549355.png

2. New a mesure.

 

Filter = 
VAR _selectdate =
    SELECTEDVALUE ( 'Table for slicer'[Date] )
VAR _filter =
    IF ( MAX ( 'Calendar'[Date] ) <= _selectdate, 1 )
RETURN
    _filter

 

3.1 For visual that have a date field, you can use this measure for the filter.

vcgaomsft_1-1661825686771.png

Result.

vcgaomsft_2-1661825726297.png

3.2 For visual like cards, you need to modify the filtering parameters in the formula.

Total = 
SUM ( 'FactSalesTable'[Sales] )
Total = 
CALCULATE (
    SUM ( 'FactSalesTable'[Sales] ),
    FILTER (
        'Calendar',
        'Calendar'[Date] <= SELECTEDVALUE ( 'Table for slicer'[Date] )
    )
)

vcgaomsft_3-1661826509882.png

The PBIX file is attached for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Hello,

 

This is a good solution, but i have a problem that I am using live connection to dax tabular cube.

Is there a different approach not using table creation?

Ideally i would like to use dropdown slicer to pick a value and show +- 15 days of range in line chart.

I cant use range slicers.

 

Thank you for your help.

 

This worked but from slicer all days of years comes. 

Capture5.PNG

I only need to see Year Month in the date slicer as below. How to sort this out?
Capture6.PNG
Do you know how to sort this @amitchandak 

(There is PBI file in this post)

mohsabbah
Frequent Visitor

I'd be grateful for your help @amitchandak

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.