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
prashanth97000
Regular Visitor

Creating a DAX Expression for Rolling Dates Based on Selected Month in Power BI in (direct query)

I’m working on a Power BI report where I have a date slicer based on a ‘Date’ column from a table. When I select a date from the slicer, I want the report to display all dates that fall on the same day and month across different years.

For example, if I select ‘5-31-2011’ from the slicer, the report should display ‘5-31-2011’, ‘5-31-2012’, ‘5-31-2013’, and so on. Essentially, I need rolling dates based on the selected day from the selected month.

I understand that I need to write a DAX expression to achieve this, but I’m not sure how to go about it. I would appreciate any guidance or sample DAX expressions that could help me achieve this functionality. Please note that I would like to implement this without using my specific table and column names.

Thanks in advance for your help!

3 REPLIES 3
prashanth97000
Regular Visitor

 
I’m working on a Power BI report where I have a date slicer based on a ‘Date’ column from a table. When I select a date from the slicer, I want the report to display all dates that fall on the same day and month across different years.

For example, if I select ‘5-31-2011’ from the slicer, the report should display ‘5-31-2011’, ‘5-31-2012’, ‘5-31-2013’, and so on. Essentially, I need rolling dates based on the selected day from the selected month.

I understand that I need to write a DAX expression to achieve this, but I’m not sure how to go about it. I would appreciate any guidance or sample DAX expressions that could help me achieve this functionality. Please note that I would like to implement this without using my specific table and column names.

Thanks in advance for your help!
many to many relationship

prashanth97000
Regular Visitor

it is not working still basically my  coonection is many to many will be a problem because fact is direct table date table is in importb and my date table for slicer is not marked as date table also

 

aduguid
Super User
Super User

Create two new columns in your date table to extract the day and month

 

Day = DAY('DateTable'[Date])
Month = MONTH('DateTable'[Date])

 

Create a measure that filters the data based on the selected date’s day and month

 

IsSameDayAndMonth = 
VAR SelectedDate = SELECTEDVALUE('DateTable'[Date])
VAR SelectedDay = DAY(SelectedDate)
VAR SelectedMonth = MONTH(SelectedDate)
RETURN
    IF(
        DAY('DateTable'[Date]) = SelectedDay && 
        MONTH('DateTable'[Date]) = SelectedMonth,
        1,
        0
    )

 

Set the filter condition to show values where IsSameDayAndMonth is 1

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!

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.