Forum Discussion

Pedro77000's avatar
Pedro77000
Frequent Visitor
6 years ago
Solved

Concatenation, date transformation: YYYYMM

Hello everyone, I am new to the forum. I have a problem and I need your help.   In a table, I have two fields of type (text). My goal is to get whole numbers (as in the goal field) to use them i...
  • Nathaniel_C's avatar
    6 years ago

    Hi Pedro77000 ,

    Text.Combine({[Year],if Text.Contains([#"Month (text)"],"10") or Text.Contains([#"Month (text)"],"11") or Text.Contains([#"Month (text)"],"12") then "" else "0",[#"Month (text)"] })

    Combines the two columns, but first does a check to see if 10 11  12 are included, if not adds a 0. (I did drop text from your year column.)

     



    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
    Nathaniel

     

  • Jimmy801's avatar
    6 years ago

    Hello Pedro77000 

     

    so a third solution you can choose of.. 🙂

    = Table.AddColumn(#"Changed Type", "Custom", each if Text.Length([#"Month (text)"])=1 then [#"Year (text)"] &"0"&[#"Month (text)"] else [#"Year (text)"]&[#"Month (text)"])

    If this post helps or solves your problem, please mark it as solution.
    Kudos are nice to - thanks
    Have fun

    Jimmy