Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Simplify this steps

Hi, I have to use 6 column to create 3 date column that I can use later. This is done with multiple steps one column t the time.

How can I simplyfy this? Is there any tips?

 

#"Promoted Headers" = Table.PromoteHeaders(#"Emner - Detaljert oversikt - Em_Sheet", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Undervis. årstall", Int64.Type}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type","HØST","8",Replacer.ReplaceText,{"Undervis. termin"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","VÅR","1",Replacer.ReplaceText,{"Undervis. termin"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value1",{{"Eksamen årstall", Int64.Type}, {"Undervis. termin", Int64.Type}}),
#"Replaced Value2" = Table.ReplaceValue(#"Changed Type1","HØST","8",Replacer.ReplaceText,{"Eksamen termin"}),
#"Replaced Value3" = Table.ReplaceValue(#"Replaced Value2","VÅR","1",Replacer.ReplaceText,{"Eksamen termin"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Replaced Value3",{{"Eksamen termin", Int64.Type}, {"Kull årstall", Int64.Type}}),
#"Replaced Value4" = Table.ReplaceValue(#"Changed Type2","HØST","8",Replacer.ReplaceText,{"Kull termin"}),
#"Replaced Value5" = Table.ReplaceValue(#"Replaced Value4","VÅR","1",Replacer.ReplaceText,{"Kull termin"}),
#"Changed Type3" = Table.TransformColumnTypes(#"Replaced Value5",{{"Kull termin", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type3", "Und_Dato", each Date.ToText(#date([Undervis. årstall], [Undervis. termin], 1))),
#"Changed Type4" = Table.TransformColumnTypes(#"Added Custom",{{"Und_Dato", type date}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type4", "Eksamen_Dato", each Date.ToText(#date([Eksamen årstall], [Eksamen termin],1))),
#"Changed Type5" = Table.TransformColumnTypes(#"Added Custom1",{{"Eksamen_Dato", type date}}),
#"Added Custom2" = Table.AddColumn(#"Changed Type5", "Kull_Dato", each Date.ToText(#date([Eksamen årstall], [Eksamen termin], 1)))
in
#"Added Custom2"

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

#"Promoted Headers" = Table.PromoteHeaders(#"Emner - Detaljert oversikt - Em_Sheet", [PromoteAllScalars=true]),
#"Replaced Value" = Table.ReplaceValue(#"Promoted Headers","HØST","8",Replacer.ReplaceText,{{"Undervis. termin"},{"Eksamen termin"},{"Kull termin"}}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value","VÅR","1",Replacer.ReplaceText,{{"Undervis. termin"},{"Eksamen termin"},{"Kull termin"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Replaced Value1",{{"Undervis. årstall", Int64.Type},{"Eksamen årstall", Int64.Type}, {"Undervis. termin", Int64.Type},{"Eksamen termin", Int64.Type}, {"Kull årstall", Int64.Type},{"Kull termin", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Und_Dato", each Date.ToText(#date([Undervis. årstall], [Undervis. termin], 1))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Eksamen_Dato", each Date.ToText(#date([Eksamen årstall], [Eksamen termin],1))),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Kull_Dato", each Date.ToText(#date([Kull årstall], [Kull termin], 1)))
#"Changed Type5" = Table.TransformColumnTypes(#"Added Custom2",{{"Eksamen_Dato", type date},{"Und_Dato", type date},{"Kull_Dato", type date}})
in
#"Changed Type5"

Your Kull_dato formula was wrong.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors