I have a report visual that display previous date , month to date and year to date which works fine as a static visual previous date - 10/30/2025 MTD - 10/1/2025 - 10/30/2025 YTD - 1/1/2025 - 10/30/2025 but the user wants the visaul to be dynamic in the sense that the visual will return results based on the date selected. When date range 1/1/2025 - 3/15/2025 is selected (or any date range) then the report should return result of previous date - 3/14/2025, MTD - 3/14/2025, YTD - 1/1/2025 - 3/14/2025, then when date range of 1/1/2025 - 10/31/2025 is selected then result should be Previous date - 10/30/2025 MTD - 10/1/2025 - 10/30/2025 YTD - 1/1/2025 - 10/30/2025 Attached is a sample copy of power bi report. Any assistance is highly appreeciated, unable to attach the PowerBI file This DAX calculation have a relationship with DimDate and result return based on any fields measures // My DAX calculation that returns Prev-Date, currnt MTD, YTD
DateCalendarSlicer =
VAR _Today = TODAY()
VAR _EOMONTH = EOMONTH(_Today, -1)
VAR _Previousday =
IF(
WEEKDAY(_Today, 2) = 1,
_Today - 3,
IF(
WEEKDAY(_Today, 2) = 7,
_Today - 2,
_Today - 1
)
)
RETURN
UNION(
ADDCOLUMNS(
CALENDAR(_Previousday, _Previousday),
"Filter", "Previous Day"&" "&_Previousday,
"Sort", 1
),
ADDCOLUMNS(
CALENDAR(DATE(YEAR(_Today), MONTH(_Today), 1), _Today),
"Filter", "MTD"&" "&MONTH(_Today),
"Sort", 2
),
ADDCOLUMNS(
CALENDAR(DATE(YEAR(_Today), 1, 1), _Today),
"Filter", "YTD"&" "&DATE(YEAR(_Today), 1, 1),
"Sort", 3
)
)
... View more