Forum Discussion

ChrWil92's avatar
ChrWil92
New Member
1 year ago
Solved

Problem with generated date and new year

Dear Fabric Community,   I have a problem with my semantic model. The input data has not date, but a date snapshot column with the following format.   202452 202501   The first four characters...
  • ChrWil92's avatar
    1 year ago

    I solved it now with adding another costum function in Power Query.

     

    = Table.AddColumn(#"Zusammengeführte Spalte eingefügt", "Date_", each if Number.ToText([Year]) <> Text.End(Date.ToText([Date]), 4) then Text.Replace(Date.ToText([Date]), Date.ToText([Date]), "01/01/" & Number.ToText([Year])) else (Date.ToText([Date])))

     

    When the snapshot says 2025, but the year of the date is different it is replacing the date to 01/01/Year from Snapshot. That should also solve it in future.