Forum Discussion
stefans124
4 years agoNew Member
Month id to month name using power query
Hello there, im having a little challenge with my dash board. Here i have a slicer, that is connected to all other tables and makes them change information based on the month selecte...
- 4 years ago
Hi stefans124,
Have a look at the following codelet Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjJUitWBsIzgLGM4ywTOMoWzzOAsczjLAs6yhLMMDRBMhC2GQGtiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id_menesis = _t]), AddMonthName = Table.AddColumn(Source, "MonthName", each Date.ToText(Date.FromText([id_menesis],[Format="yyyyM"]),"MMMM"),type text), AddMonthNum = Table.AddColumn(AddMonthName, "MonthNum", each Int64.From(Text.Middle([id_menesis], 4,2)), Int64.Type) in AddMonthNum
You will need the MonthNum integer column to sort the month names. See this link
SpartaBI
Community Champion
4 years agoHi stefans124,
Have a look at the following code
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjJUitWBsIzgLGM4ywTOMoWzzOAsczjLAs6yhLMMDRBMhC2GQGtiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id_menesis = _t]),
AddMonthName = Table.AddColumn(Source, "MonthName", each Date.ToText(Date.FromText([id_menesis],[Format="yyyyM"]),"MMMM"),type text),
AddMonthNum = Table.AddColumn(AddMonthName, "MonthNum", each Int64.From(Text.Middle([id_menesis], 4,2)), Int64.Type)
in
AddMonthNum
You will need the MonthNum integer column to sort the month names. See this link