Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
lsullivan6311
Helper III
Helper III

Calculate Days in Month based on Year/Month to add column to Dates table for use in other formulas

I need the total number of days in the month based on the Year/Month; for example,

Year/Month            MonthName              MonthNo         NoOfDays

2022/01                    January                           1                      31      

2022/02                    February                         2                      28

 

so that is the year was a leap year, February would have 29 days.  I will be using a Year/Month filter on visuals and a measure that will need the days in the month to calculate unit hours in that month.  I have the measure I need already, but I just need to update for the filtered number of days.

 

 

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

You can use this expression in a calculated column, provided you have a column with a date value within the desired month.

 

DaysInMonth = DAY(EOMONTH('Date'[Date], 0))

 
Or in a measure, you can also put any expression that returns a date inside EOMONTH too.
 
Pat
 
Microsoft Employee

View solution in original post

1 REPLY 1
ppm1
Solution Sage
Solution Sage

You can use this expression in a calculated column, provided you have a column with a date value within the desired month.

 

DaysInMonth = DAY(EOMONTH('Date'[Date], 0))

 
Or in a measure, you can also put any expression that returns a date inside EOMONTH too.
 
Pat
 
Microsoft Employee

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.