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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Learner22
Helper I
Helper I

How can I link a measure with a date slicer

Dear Commnity,

 

I have a measure like this

 

Number of Requests

20.000

Date from until now (for example 01/01/2021 until 11/21/2022)

 

And I have a date slicer for the last 2 years and months. For example, if I select the month September from the year 2022 the year 2022 then I want that Date from should be replaced by the selected date.

My meausure should look like this

 

Number of requests

500

September 2022 until 11/21/2022.

 

How can I do this?

 

Thank you very much.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Learner22 ,

I created some data:

vyangliumsft_0-1669187753640.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
CALENDAR(
    DATE(2020,1,1),DATE(2022,12,31))

2. Create measure.

Measure =
var _selectyear=SELECTEDVALUE('Table 2'[Date].[Year])
var _selectmonth=SELECTEDVALUE('Table 2'[Date].[Month])
var _monthnumber=MAXX(FILTER(ALL('Table 2'),
FORMAT('Table 2'[Date],"mmmm")=_selectmonth),MONTH('Table 2'[Date]))
return
SUMX(FILTER(ALL('Table'),'Table'[Date]>=DATE(_selectyear,_monthnumber,1)&&'Table'[Date]<=TODAY()),[Value])

3. Result:

vyangliumsft_1-1669187753643.png

 

Best Regards,

Liu Yang

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

3 REPLIES 3
Anonymous
Not applicable

Hi  @Learner22 ,

I created some data:

vyangliumsft_0-1669187753640.png

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
CALENDAR(
    DATE(2020,1,1),DATE(2022,12,31))

2. Create measure.

Measure =
var _selectyear=SELECTEDVALUE('Table 2'[Date].[Year])
var _selectmonth=SELECTEDVALUE('Table 2'[Date].[Month])
var _monthnumber=MAXX(FILTER(ALL('Table 2'),
FORMAT('Table 2'[Date],"mmmm")=_selectmonth),MONTH('Table 2'[Date]))
return
SUMX(FILTER(ALL('Table'),'Table'[Date]>=DATE(_selectyear,_monthnumber,1)&&'Table'[Date]<=TODAY()),[Value])

3. Result:

vyangliumsft_1-1669187753643.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

FreemanZ
Super User
Super User

yes, DATESBETWEEN function allows to pinpoint the start and end date of your calculation. 

the start date in your case seems MAX(the column you put to slicer) and the end date you can put it TODAY().

Sorry, this doesn't work. If I select a specific month, the measure doesn't reflect that.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.