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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cosminc
Post Partisan
Post Partisan

days number of each year-month

Hi

is it posible starting from columns month no (1-12) and year to obtain a column with number of days of each year-month?

 

Year    Month  Days

2019     1           31

2019       2         28

2019        1        31

etc 

Thanks!

Cosmin

 

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @cosminc,

 

If I understand your scenario correctly that you only have Year and Month column, you want to get the days based on the year and month columns?

 

If it is, we could achieve that in Power BI, please follow the steps below.

 

If your month and year columns are text type, you could create a custom column in query editor and then change the column to be date type.

 

=[Year]&"-"&[Month]

create a date column.PNG

After Close&&Apply, you could create a calculated column with the formula below.

Days = DAY(EOMONTH([Date],0))

Here is the output.

 

days.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @cosminc,

 

If I understand your scenario correctly that you only have Year and Month column, you want to get the days based on the year and month columns?

 

If it is, we could achieve that in Power BI, please follow the steps below.

 

If your month and year columns are text type, you could create a custom column in query editor and then change the column to be date type.

 

=[Year]&"-"&[Month]

create a date column.PNG

After Close&&Apply, you could create a calculated column with the formula below.

Days = DAY(EOMONTH([Date],0))

Here is the output.

 

days.PNG

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi

this is it

thanks!

Cosmin

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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