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
salexa
Helper II
Helper II

Show date values in slicer for selected MonthYear and before

Hi,

 

I have a table with columns for Date Contract and Date Deliver as in the example below:

Date ContractDate DeliverID
1/09/2019 1
5/10/2019 2
9/10/2019       27/10/20193
1/11/20191/11/20194
1/12/20195/12/20195

I want to able able create a MonthYear slicer and when I select a month, eg Oct2019, to have another slicer for Date Contract that will display only the date values for Oct2019and before(1/09/2019,5/10/2019 and 9/10/2019) and another slicer for Date Deliver taht will display date values for Oct and after(27/10/2019/01/11/2019/05/12/2019).

 

I can't figure out the dax formula for it, I've tried to cerate a measure with if an selectedvalue but no luck so far.

 

Thanks!

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Take a look at the attached file. 

Generally you are going to want to have atleast 1 completly unrelated calendar table that you will use as a slicing table. This is going to act as the source for the plain Year/month slicer. 

The idea is to use 2 different measure, like the ones in my demo file to get the selected date/yearmonth and then use that as a visual level filter on the other two slicers. 

Take a look and let me know how it goes!

Br,
J


Connect on LinkedIn

View solution in original post

5 REPLIES 5
tex628
Community Champion
Community Champion

Take a look at the attached file. 

Generally you are going to want to have atleast 1 completly unrelated calendar table that you will use as a slicing table. This is going to act as the source for the plain Year/month slicer. 

The idea is to use 2 different measure, like the ones in my demo file to get the selected date/yearmonth and then use that as a visual level filter on the other two slicers. 

Take a look and let me know how it goes!

Br,
J


Connect on LinkedIn

it's working, thanks.

I just updated a litle bit the formula for over, to take in consideration also teh dates for the selected month when using a filter YearMonth

 

Thanks

amitchandak
Super User
Super User

@salexa , Create an independent date slicer and use that in measure

Measure 2 =
var _max = maxx(allselected('Date') , 'Date'[Date])
var _min = minx(allselected('Date') , 'Date'[Date])
return
calculate(countrows('Table'), Filter(all('Table'), 'Date'[Date Contract] <=_max && 'Date'[Date Deliver] >=_min ))

 

or

 

Measure =
var _max = maxx(allselected('Date') , 'Date'[Date])
var _min = minx(allselected('Date') , 'Date'[Date])
return
calculate(countrows('Table'), Filter(all('Table'), 'Date'[Date Contract] <=_max ))

Measure 1=
var _max = maxx(allselected('Date') , 'Date'[Date])
var _min = minx(allselected('Date') , 'Date'[Date])
return
calculate(countrows('Table'), Filter(all('Table'), 'Date'[Date Deliver] >=_min ))

tex628
Community Champion
Community Champion

Just making sure i understadn the requirement. 

You want 3 slicers. 

One plain Year/Month. 

One slicing contract date. Showing the selected month and every date before that. 

One slicing delivery date. Showing the selected month and every date after that.

Am i correct? 

/ J


Connect on LinkedIn

yes, you've summed up correctly my need

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.