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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
gbarr12345
Post Prodigy
Post Prodigy

Calculated column showing just Month and Year

Hi everyone,

 

I'm hoping you can help me.

 

I'm trying to create a new calculated column to split up a date to just show Month and Year. I can't seem to find a good calculated column code to do this.

 

Can anybody help me with this please?

 

gbarr12345_0-1719369849289.png

 

1 ACCEPTED SOLUTION

Hi,

In case your existing column is text type (if it is not date type), please try something like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1719462215381.png

 

result 01 CC = 
VAR _day =
    DAY ( Data_v2[Month] )
VAR _month =
    MONTH ( Data_v2[Month] )
VAR _year =
    YEAR ( Data_v2[Month] )
RETURN
    FORMAT ( DATE ( _year, _month, _day ), "mmmm-yyyy" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1719370866075.png

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hi Jihwan,

 

Thank you for your reply.

 

I tried your formula but it still seems to be showing the full month.

 

gbarr12345_0-1719450992710.pnggbarr12345_1-1719450999648.png

 

Any idea why this is the case?

Hi,

In case your existing column is text type (if it is not date type), please try something like below.

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1719462215381.png

 

result 01 CC = 
VAR _day =
    DAY ( Data_v2[Month] )
VAR _month =
    MONTH ( Data_v2[Month] )
VAR _year =
    YEAR ( Data_v2[Month] )
RETURN
    FORMAT ( DATE ( _year, _month, _day ), "mmmm-yyyy" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Apologies, I only got around to seeing this now.

 

That worked for me so thank you so much!

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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