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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

DAX - whole number month and year to date format

I have columns that are month and year as whole numbers ...so year is 2022, month is 1,2,3, etc.  

 

I would like to have those columns merge and display as Jan-22, Feb-22, Mar-22, etc

 

I've tried playing with formatting and switching things to dates but can't quite get there. 

 

Does anyone know what I should be doing to get that result?

1 ACCEPTED SOLUTION
selinaz
Resolver II
Resolver II

Hi @Anonymous ,

 

Is this result you want to achieve?

selinaz_0-1660032137760.png

I used power query to complete this process.
Refer to the following steps:

1.transform the type of two cloumns to "Text"

2.duplicate the "Year" column

3.Check this column and select “split column”---"by number of characters", then delete left column

selinaz_1-1660033238438.png

selinaz_2-1660033448235.png

selinaz_3-1660033521557.png

4.choose "add column"---"custom column"

selinaz_4-1660033604184.png

5.write this sytnax:

selinaz_5-1660033669495.png

[Month]&"-"&[#"Year - Copy.2"]

6.finally you can get the result.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Best regards.

 

View solution in original post

3 REPLIES 3
WinterMist
Impactful Individual
Impactful Individual

Hello @Anonymous 

 

If either reply from @selinaz or myself was helpful, please consider marking them as solutions.

 

If there is something more that you need, please let us know.

 

Regards,

Nathan

selinaz
Resolver II
Resolver II

Hi @Anonymous ,

 

Is this result you want to achieve?

selinaz_0-1660032137760.png

I used power query to complete this process.
Refer to the following steps:

1.transform the type of two cloumns to "Text"

2.duplicate the "Year" column

3.Check this column and select “split column”---"by number of characters", then delete left column

selinaz_1-1660033238438.png

selinaz_2-1660033448235.png

selinaz_3-1660033521557.png

4.choose "add column"---"custom column"

selinaz_4-1660033604184.png

5.write this sytnax:

selinaz_5-1660033669495.png

[Month]&"-"&[#"Year - Copy.2"]

6.finally you can get the result.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Best regards.

 

WinterMist
Impactful Individual
Impactful Individual

@Anonymous 

 

1) Create a new table for Months as follows:

WinterMist_0-1659645150938.png

 

2) Create a 1:* relationship between the 2 tables as follows:

WinterMist_2-1659645330519.png

 

 

3) Create a new calculated column in the 'Data' table as follows:

WinterMist_3-1659645540354.png

 

 

Regards,

Nathan

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors