Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
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! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
78 | |
54 | |
39 | |
35 |
User | Count |
---|---|
102 | |
84 | |
48 | |
48 | |
48 |