Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I currently have the below DAX to get the First day of the last 2nd month. I mean, when i select 4-Nov-2020 this gives date as 1-Oct-2020 which is correct.
last 2 months = EDATE ( EOMONTH ( SELECTEDVALUE(Query1[STARTDATE] ), 0 ), -2 ) + 1
But when i select a date 25-Sep-2020 this gives date as 31-Jul-2020 instead of 1-Aug-2020.
I know this behaviour is because we are adding 1 day at the end. But any idea how can i get 1-Aug-2020?
Solved! Go to Solution.
Hi @Anonymous ,
Try to use DATESBETWEEN to create a measure like so:
Measure =
CALCULATE (
AVERAGE ( 'Table'[Value] ),
ALL ( 'Table' ),
DATESBETWEEN ( 'Table'[Date], [Last 2 month], [End of last month] )
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
Try like
EOMONTH ( SELECTEDVALUE(Query1[STARTDATE] ), -2 )+ 1
@amitchandak thanks Amit
I have another question with respect to the same date.
Hi @Anonymous ,
Try to use DATESBETWEEN to create a measure like so:
Measure =
CALCULATE (
AVERAGE ( 'Table'[Value] ),
ALL ( 'Table' ),
DATESBETWEEN ( 'Table'[Date], [Last 2 month], [End of last month] )
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
93 | |
84 | |
66 |