March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all,
We want to create a report and faced a problem, that we will need to solve also for future reports.
In our current implementation, we use a slicer on one column of our date-table that filters the Calendarweek (Format YYYY.WW).
The values of a table-visual are filtered using this selected value and that works fine.
Now we have another visual, that we want to filter by the month that corresponds to the last day of our week. I.E. if we consider calendar week 48 in 2024 we get the 01.12.2024 as the last day of the week. So we want to filter our second visual to use all dates in december 2024.
Currently we are having problems creating a dynamic filter criterion that filters our second visual based on the corresponding month of the selection of our week slicer.
Does anyone have some suggestions how we can implement this in PowerBI?
Thanks in advance
Hi @IvBa
Thanks to mark_endicott for the great reply.
Please allow me to add another solution:
1. Create a slicer with Calendarweek column
2. Create a measure with the following DAX:
FilteredValues =
VAR LastDayOfWeek = MAX('Table'[Date])
VAR SelectedMonth = MONTH(LastDayOfWeek)
RETURN
CALCULATE(
SUM('Table'[Amount]),
FILTER(
ALL('Table'),
MONTH('Table'[Date]) = SelectedMonth
)
)
Sample data:
Result:
Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@IvBa - You can use variables ( VAR ) to define a Range Start and End for your month, then use these in combination with REMOVEFILTERS( DateTable ) to change the filter context for the measures in your 2nd visual. Your measures will probably look something like this:
VAR _selected_week = MAX( 'Datetable'[week ending] )
VAR _range_start = EOMONTH( _selected_week, -1 ) +1
VAR _range_end = EOMONTH( _selected_week, 0 )
RETURN
CALCULATE( [Measure], REMOVEFILTERS( 'Datetable' ), 'Datetable'[Date] >= _range_start && 'Datetable'[Date] <= _range_end )
If this sample DAX helps you, please mark it as the solution to help others with the same challenge.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
15 | |
12 | |
9 | |
8 |
User | Count |
---|---|
41 | |
32 | |
29 | |
12 | |
12 |