Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
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:
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.
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!
Solved! Go to Solution.
@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.
When you select an EventName the date slicer shows all the months between the two dates.
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.
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?
@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.
When you select an EventName the date slicer shows all the months between the two dates.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
86 | |
84 | |
83 | |
67 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |