Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Solved! Go to Solution.
This measure ensures that whenever you select a date (or a report runs for a certain period), it finds the total number of working days for that month, ignoring any other filters that may affect the calculation.
1) VAR _date = Max(DimDate[Date]) ---> You'e assigning Max Date from the DimDate dimension to the variable _date
2) Calculate Working Days for the Month:
CALCULATE([TotalWorkingDays], ...) → This retrieves the total working days but applies filters to make sure it only considers the selected month.
The FILTER(ALL(DimDate), DimDate[Year] = YEAR(_date) && DimDate[MonthNum] = MONTH(_date)) part:
ALL(DimDate) → Ignores any existing filters on the date table to check all dates.
DimDate[Year] = YEAR(_date) & DimDate[MonthNum] = MONTH(_date) → Only keeps the dates that match the year and month of the selected date.
Some suggestions:
This measure ensures that whenever you select a date (or a report runs for a certain period), it finds the total number of working days for that month, ignoring any other filters that may affect the calculation.
1) VAR _date = Max(DimDate[Date]) ---> You'e assigning Max Date from the DimDate dimension to the variable _date
2) Calculate Working Days for the Month:
CALCULATE([TotalWorkingDays], ...) → This retrieves the total working days but applies filters to make sure it only considers the selected month.
The FILTER(ALL(DimDate), DimDate[Year] = YEAR(_date) && DimDate[MonthNum] = MONTH(_date)) part:
ALL(DimDate) → Ignores any existing filters on the date table to check all dates.
DimDate[Year] = YEAR(_date) & DimDate[MonthNum] = MONTH(_date) → Only keeps the dates that match the year and month of the selected date.
Some suggestions:
This measure first captures the date that is currently being used in the visual or calculation context by storing MAX(DimDate[Date]) in the variable _date. It then uses the CALCULATE function to compute [TotalWorkingDays], but it replaces any existing date filters with a new filter that only keeps rows in DimDate matching the year and month of _date. This ensures the measure returns the total working days for the entire month and year associated with the selected date, rather than just a single day or any other filtered period.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |