Forum Discussion
Anonymous
6 years agoNot applicable
Days in Current Month
Hello All, I want to return the number of days in July and I used the measure below measure. It returns 30 days instead of 31 days. Days_In_Current_Month = DAY(ENDOFMONTH('Date'[Date])) ...
- 6 years ago
If you meant currently selected month then you can use
Days in current month = COUNTROWS ( VALUES ( Dates[Date] ) )or
Days in current month = DISTINCTCOUNT( Dates[Date] )if you meant in July 2020 then
Days in current month = COUNTROWS ( FILTER ( Dates, Dates[Month Number] = MONTH ( TODAY () ) && Dates[Calendar Year Number] = YEAR ( TODAY () ) ) )
AntrikshSharma
Community Champion
6 years agoCalendar year number is just year like 2020, 2019 etc do you have the dates for 2020 in your table?
Anonymous
6 years agoNot applicable
yes i do.
- Anonymous6 years agoNot applicable
Hi Anonymous ,
The above solution looks correct.
However you can try,
Create a Calculated Column in your Date Table.
YearMonthnumber = FORMAT ( Dates[Date],"YYYYM")Then create a measure
Days in current Month = VAR _month = MONTH ( TODAY () ) VAR _year = YEAR ( TODAY () ) RETURN COUNTROWS ( FILTER ( ALL ( Dates ), Dates[YearMonthnumber] = CONCATENATE ( _year, _month ) ) )
Regards,Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)Did I answer your question? Mark my post as a solution!
- Anonymous6 years agoNot applicable
Anonymous
this worked correctly.
Thank you