+ Reply to Thread
Results 1 to 4 of 4

Power Query concatenation using &

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    779

    Power Query concatenation using &

    Hi,
    have a question regarding joing dates or number and text in power Q;

    If I have a date column and then create two more so;

       Date.Year(date)
    and
     Date.MonthName([Date])

    and then go to addcustomcolumn and join them
      [Year]&"-"&[Month] ,
    But if I don't add these helper columns I seem to need to covert the year to text first;


    Text.From(Date.Year([Date]))&"-"&Date.MonthName([Date]))
    why? I can see that the DateYear does return a text value ( left side) , but if that's the case shouldn't it work within the concatenation?

    Richard.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: Power Query concatenation using &

    Date.Year returns a nullable number, not text.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    779

    Re: Power Query concatenation using &

    Yes, you're right just tried again, I don't know what I did but I did manage to join the two, Month Name and Year without converting to text,

    Not sure what I did as I've deleted it in frustration to start again from scratch.

    RD

  4. #4
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Power Query concatenation using &

    maybe try
        #"Extracted Year" = Table.TransformColumns(Source,{{"Year", Date.Year, Int64.Type}}),
        #"Extracted Month Name" = Table.TransformColumns(#"Extracted Year", {{"Month", each Date.MonthName(_), type text}}),
        #"Merged Columns" = Table.CombineColumns(Table.TransformColumnTypes(#"Extracted Month Name", {{"Year", type text}}, "en-GB"),{"Year", "Month"},Combiner.CombineTextByDelimiter("-", QuoteStyle.None),"Merged")

    yearmonthname.png

    Year Month Merged
    14/11/2022
    14/11/2022
    2022-November
    Last edited by sandy666; 11-14-2022 at 11:05 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Power Query/Power Pivot Conditional Column creation & chart
    By mz_h in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 12-12-2020, 06:07 PM
  2. [SOLVED] 2 fields checker- Request for alternative option in Power Query or Power Pivot
    By Shareez Saleem in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-15-2020, 08:36 AM
  3. Replies: 10
    Last Post: 06-25-2020, 12:19 AM
  4. [SOLVED] Power Query - excel formula translation into Power Query
    By afgi in forum Excel Charting & Pivots
    Replies: 7
    Last Post: 02-19-2020, 03:38 AM
  5. Replies: 4
    Last Post: 02-17-2020, 06:03 AM
  6. Excel Power Query Refresh or Access Query - 2nd Query Run is faster
    By Steveapa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-03-2020, 10:16 AM
  7. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1