Forum Discussion
PPalkowski
6 years agoHelper II
Trying to get decade from year
I am new to power query, couldn't find an easy solution I am trying to get the decade from the year, slowly built this Added column: This takes a year and converts it to text = Table.AddColumn...
- 6 years ago
Hi, try pasting below to your blank Advanced Query editor and see if it does what you are after, line below the comment is I believe what you are after.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlCK1QExDE1hDBMYAyZlYAxmGFpaWkIZFqZQhgmQEQsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}}), // Below is all in one line, hope that helps #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Start(Text.From([Year]),3)&"0s") in #"Added Custom"
solexecution
6 years agoFrequent Visitor
Hi, try pasting below to your blank Advanced Query editor and see if it does what you are after, line below the comment is I believe what you are after.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMlCK1QExDE1hDBMYAyZlYAxmGFpaWkIZFqZQhgmQEQsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Year = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Year", Int64.Type}}),
// Below is all in one line, hope that helps
#"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Text.Start(Text.From([Year]),3)&"0s")
in
#"Added Custom"PPalkowski
6 years agoHelper II
Prefect... now I need to break this down and see what you did so I can learn from it
- Smauro6 years agoSolution Sage
PPalkowski you could also use mod10 for probably less pqengine effort:
[Year] - Number.Mod( [Year], 10 )