cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stefans124
New Member

CONTATENATEX Formula

Hello, im having difficulties understanding the CONTATENATEX formula. I am a complete beginner in this code writing world but i need the formula to conjoin two columns into one for my studies project.

My task is to conjoin columns "Year" and "Month number" into a new column that would join those together showing a year and month together, respectively 202101, 202102 etc. Im just confused about where in the code should i put the formula and what to write in it. Any help will be appreciated! (Look at the picture below for the table and code)

stefans124_0-1655279444321.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

@stefans124 

Date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "mmmm" ),
    "Month Number", MONTH ( [Date] ),
    " Year Month Number",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

@stefans124 

Date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "Year", YEAR ( [Date] ),
    "Month", FORMAT ( [Date], "mmmm" ),
    "Month Number", MONTH ( [Date] ),
    " Year Month Number",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] )
)

Hey, thank you very much Tamer, really saved my day! Kudos to You!

 

tamerj1
Super User
Super User

Hi @stefans124 
Just add anew line inside ADDCOLUMNS
" Year Month Number", YEAR ( [Date] ) * 100 + MONTH ( [Date] )

stefans124
New Member

Date =

ADDCOLUMNS (

 CALENDARAUTO(),

 "Year", YEAR([Date]),

 "Month", FORMAT([Date], "mmmm"),

 

 "Month Number", MONTH([Date])

 

)

 

 

(this is the code written)

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Top Solution Authors
Top Kudoed Authors