Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Solved! Go to Solution.
Hi @muktapurc ,
You can create a measure
Dynamic Date Filter =
VAR TodayDate = TODAY()
VAR FirstDayOfThisMonth = DATE(YEAR(TodayDate), MONTH(TodayDate), 1)
VAR LastDayOfLastMonth = FirstDayOfThisMonth - 1
VAR FirstDayOfLastMonth = DATE(YEAR(LastDayOfLastMonth), MONTH(LastDayOfLastMonth), 1)
RETURN
IF(
SELECTEDVALUE('Table'[Date]) >= FirstDayOfLastMonth && SELECTEDVALUE('Table'[Date]) <= LastDayOfLastMonth,
1,
0
)
Apply the measure to the filter on this visual and set it is 1
The above is a filter based on today's date, you can replace today() with your desired date
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @muktapurc ,
You can create a measure
Dynamic Date Filter =
VAR TodayDate = TODAY()
VAR FirstDayOfThisMonth = DATE(YEAR(TodayDate), MONTH(TodayDate), 1)
VAR LastDayOfLastMonth = FirstDayOfThisMonth - 1
VAR FirstDayOfLastMonth = DATE(YEAR(LastDayOfLastMonth), MONTH(LastDayOfLastMonth), 1)
RETURN
IF(
SELECTEDVALUE('Table'[Date]) >= FirstDayOfLastMonth && SELECTEDVALUE('Table'[Date]) <= LastDayOfLastMonth,
1,
0
)
Apply the measure to the filter on this visual and set it is 1
The above is a filter based on today's date, you can replace today() with your desired date
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
VAR FirstDayOfLastMonth =Date(Year(LastDayOfLastMonth),1)
Here you are adding one day to LastDayOfLastMonth?
Hi @muktapurc ,
You need to associate it with the previous variable
VAR FirstDayOfThisMonth = DATE(YEAR(TodayDate), MONTH(TodayDate), 1)
This line of code calculates the first day of the month and stores it in the variable FirstDayOfThisMonth.
VAR LastDayOfLastMonth = FirstDayOfThisMonth - 1
This line of code gets the last day of the previous month by subtracting one day from the first day of the month and storing it in the variable LastDayOfLastMonth.
VAR FirstDayOfLastMonth = DATE(YEAR(LastDayOfLastMonth), MONTH(LastDayOfLastMonth), 1)
This line of code calculates the first day of the previous month and stores it in the variable FirstDayOfLastMonth.
All of the above variables are obtained through you VAR TodayDate = TODAY() to do the calculations, in fact it's enough to just get this date.
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @muktapurc
Please share more details and screenshots to get an answer quickly
Proud to be a Super User! | |