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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
CleliaComes
Helper I
Helper I

Count Of days in Months (table)

Hi all,

 

I want to count the days in the month January, February, etc.

How can I make a column that will go to the calendar of 2020 and input the number of that month.  

For example January 2020 – 31 days, February 2020-29 days.

I found a formula in the community but it doesn’t work for me:

 

DaysInMonthColumn=SWITCH(MONTH([Date]), 1, 31, 2, 29, 3, 31, 4, 30 

               , 5, 31, 6, 30, 7, 31, 8, 31 

               , 9, 30, 10, 31, 11, 30, 12, 31 

               , BLANK() )

 

The table that I created shows the sales figures per month. I calculated the Days in Year with the COUNTROWS function. 

Days in year = COUNTROWS(Kalender) and I was wondering if I could add something to count the days in a month?
 
 

 

Kind regards,

Clélia

 
 
 
1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @CleliaComes ,

 

You can try creating a calculated column as follows:

daysInMonth =
DAY ( EOMONTH ( ClothingSales[Date], 0 ) )

 

I tried it at my end and gives me the following result:

Pragati11_0-1614335702545.png

 

Thanks,

Pragati

 



Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

2 REPLIES 2
CleliaComes
Helper I
Helper I

Thank you very much it works! 

Pragati11
Super User
Super User

Hi @CleliaComes ,

 

You can try creating a calculated column as follows:

daysInMonth =
DAY ( EOMONTH ( ClothingSales[Date], 0 ) )

 

I tried it at my end and gives me the following result:

Pragati11_0-1614335702545.png

 

Thanks,

Pragati

 



Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.