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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Single datefilter with start date from table 1 and end date from table 2

Hi Community,

In need of your help, been struggling on this one for hours!

I've got a data model with multiple fact tables and dimension tables:

Jorn_Mazet_0-1620999401875.png


I've got a different date filter (in yellow) for both data visuals (one from Sales and one from Actions), this works fine. 
At the moment I presented this report, users ask me to have only one date filter for both table-visuals.

Jorn_Mazet_1-1620999440256.png

 

Now comes the difficult part: when filtering per event, they ask to have the first date = DT_PlanningActions[Start_Action] and the last date = DT_Event[EventEndDate]

 

I've tried finding a measure that I can use to filter the dateslicer, but I can't find the solution.

Samble pbix here

Hope you folks can help me out!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

I think I know what you are going for and was able to get it.  I wrote a new measure for use in filtering the date slicer.

Date Filter = 
VAR _EventEnd =
    SELECTEDVALUE ( DT_Event[EventEndDate] )
VAR _Event =
    SELECTEDVALUE ( DT_Event[Event_id] )
VAR _PlanningStart =
    CALCULATE (
        SELECTEDVALUE ( DT_PlanningActions[Start_Action] ),
        TREATAS ( { _Event }, DT_PlanningActions[Event_id] )
    )
VAR _Dates =
    DATESBETWEEN ( DT_DateTable[Date], _PlanningStart, _EventEnd )
RETURN
    CALCULATE (
        COUNTROWS ( DT_DateTable ),
        KEEPFILTERS ( TREATAS ( _Dates, DT_DateTable[Date] ) )
    )

Then I applied that to the date slicer and set it to is not blank.

jdbuchanan71_0-1621011518266.png

When you select an EventName the date slicer shows all the months between the two dates.

jdbuchanan71_1-1621011598927.png

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@jdbuchanan71 
Now I get it! Thanks a bunch!!

jdbuchanan71
Super User
Super User

Sure, I can give it a go.  The first two variables _EventEnd and _Event just read the Date and Event_ID based on the event selected.  

Next we use the Event_ID to ficure out the PlanningStart date so now we have out two dates _PlanningStart and _EventEnd.

_Dates uses these two dates to generate the list of dates between the _PlanningStart and _EventEnd

Finally we count the rows in the dates table using the list of dates in the _Dates variable as a filter using TREATAS.  Since the count is filtered it will return BLANK when it is outside the range of dates.

Anonymous
Not applicable

Hi @jdbuchanan71 ,
That seems to do the trick!!
I'm also trying to understand how you did this;
The result of the measure is the amount of days between start & end, right? I don't understand how this filters the date filter to give the correct months 😅😲. Could you maybe help me understand?

jdbuchanan71
Super User
Super User

@Anonymous 

I think I know what you are going for and was able to get it.  I wrote a new measure for use in filtering the date slicer.

Date Filter = 
VAR _EventEnd =
    SELECTEDVALUE ( DT_Event[EventEndDate] )
VAR _Event =
    SELECTEDVALUE ( DT_Event[Event_id] )
VAR _PlanningStart =
    CALCULATE (
        SELECTEDVALUE ( DT_PlanningActions[Start_Action] ),
        TREATAS ( { _Event }, DT_PlanningActions[Event_id] )
    )
VAR _Dates =
    DATESBETWEEN ( DT_DateTable[Date], _PlanningStart, _EventEnd )
RETURN
    CALCULATE (
        COUNTROWS ( DT_DateTable ),
        KEEPFILTERS ( TREATAS ( _Dates, DT_DateTable[Date] ) )
    )

Then I applied that to the date slicer and set it to is not blank.

jdbuchanan71_0-1621011518266.png

When you select an EventName the date slicer shows all the months between the two dates.

jdbuchanan71_1-1621011598927.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.