cancel
Showing results for 
Search instead for 
Did you mean: 
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 III
Super User III

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

 







If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


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 III
Super User III

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

 







If this helps, Appreciate a KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.