Forum Discussion

Jeanxyz's avatar
Jeanxyz
Power Participant
3 years ago
Solved

convert date to text

I want to create a key column Source_Target_Date in the format of  USD_USD_10/18/2022. Below is what I get, how can I avoid the "-" symbol in the column?

 

  • Jeanxyz's avatar
    Jeanxyz
    3 years ago

    I tried the DAX below and get AUD_AUD_10-18-2022.  

    Column = 'Table'[Converted currency]&"_"&'Table'[budget currency]&"_"&FORMAT('Table'[dateid],"MM/DD/YYYY")

     Below is how I solve the problem. However, it's a bit complicated, so I was hoping there is an easier solution. 

    Source_Target_Date = [Converted Currency]&"_"&[Budget Currency] &"_"&format(month([DateID]),"0#") &"/"&format(day([DateID]),"0#") &"/"&year([DateID])
     
     

4 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Jeanxyz ,

     

    You can try like this:-

    Column = 'Table'[Converted currency]&"_"&'Table'[budget currency]&"_"&FORMAT('Table'[dateid],"MM/DD/YYYY")
    • Jeanxyz's avatar
      Jeanxyz
      Power Participant

      I tried the DAX below and get AUD_AUD_10-18-2022.  

      Column = 'Table'[Converted currency]&"_"&'Table'[budget currency]&"_"&FORMAT('Table'[dateid],"MM/DD/YYYY")

       Below is how I solve the problem. However, it's a bit complicated, so I was hoping there is an easier solution. 

      Source_Target_Date = [Converted Currency]&"_"&[Budget Currency] &"_"&format(month([DateID]),"0#") &"/"&format(day([DateID]),"0#") &"/"&year([DateID])
       
       
  • Arul's avatar
    Arul
    Super User

    Jeanxyz ,

    This may help you,

    Source_Target_Date = [Converted Currency]&"_"&[Budget Currency]&"_"&FORMAT([DateID],"DDMMYYYY")

    Thanks, 

  • Hi Jeanxyz ,

     

    for me it works easily. I think that is important that you don“t change the data type in Power Query from date to text.