Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi
Can somebody please tell me why End of month formula is working for 1 jul 22 but not working for 1 jul 23 ? Screeshot below of a table view
Solved! Go to Solution.
Hi @ashwinkolte
If you want to return the last day of the year/month of 'Calendar'[Date] in a calculated column, I would instead suggest:
End of month =
EOMONTH ( 'Calendar'[Date], 0 )
The ENDOFMONTH function is one of the time intelligence functions that normally used for modifying filters within CALCULATE/CALCULATETABLE.
It returns a 1x1 table which contains the last day that exists in that column in the same month/year of the maximum date in the filter context.
Behind the scenes the date column reference is actually converted to
CALCULATETABLE ( DISTINCT ( 'Calendar'[Date] ) )
See https://dax.guide/ENDOFMONTH/ for more info.
ENDOFMONTH (and other time intelligence functions) are restricted to returning dates that actually exist in the referenced column, so my guess is that the maximum value of 'Calendar'[Date] in July 2023 is 1-July-2023, while the max value in July 2022 is 31-July-2022. You could also solve your issue by ensuring 'Calendar' contains complete calendar months (which is best practice in general).
Regards
Hi @ashwinkolte
If you want to return the last day of the year/month of 'Calendar'[Date] in a calculated column, I would instead suggest:
End of month =
EOMONTH ( 'Calendar'[Date], 0 )
The ENDOFMONTH function is one of the time intelligence functions that normally used for modifying filters within CALCULATE/CALCULATETABLE.
It returns a 1x1 table which contains the last day that exists in that column in the same month/year of the maximum date in the filter context.
Behind the scenes the date column reference is actually converted to
CALCULATETABLE ( DISTINCT ( 'Calendar'[Date] ) )
See https://dax.guide/ENDOFMONTH/ for more info.
ENDOFMONTH (and other time intelligence functions) are restricted to returning dates that actually exist in the referenced column, so my guess is that the maximum value of 'Calendar'[Date] in July 2023 is 1-July-2023, while the max value in July 2022 is 31-July-2022. You could also solve your issue by ensuring 'Calendar' contains complete calendar months (which is best practice in general).
Regards
Thanks for the explanation !
User | Count |
---|---|
98 | |
90 | |
82 | |
73 | |
67 |
User | Count |
---|---|
115 | |
102 | |
98 | |
71 | |
67 |