Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
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! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |