Forum Discussion
Anonymous
4 years agoNot applicable
How to sort week proper order in bar chart Power BI
Sample data Funnel_Id Snap_week Stage Name 3DMCR-OPP111263:Week 1 week 10 Closed Won 3DMCR-OPP111249:Week 1 week 8 Closed Won 3DMCR-OPP111570:Week 1 week 9 Validate Opportunity ...
- 4 years ago
Add another column with the numeric week value, and then sort your Snap_week column by the new column.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdFBC4IwGMbxrzI8G23TTesWdqy0oDyYh5ErJNlEZ+G3b3mJXkFv/8vvZTzLMsfb7qPTIk4SQgjl3jqV8omI4zrvIbCtqNKtLFCqlZO7QPgrIMJpwAIMwMrGRVRlIYxEcV3rxnSqNP2Icp8Bym2cVSGb1ghVTGLmcYCD30N3ujVjEQZAsFkRAuHNCQrn820c5EOb8jvHtcOYcjScWEZamUbcDEKbum70S1TjewxORKa/I6BwFmrj2Nn/uPf/g+Yf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Funnel_Id = _t, Snap_week = _t, #"Stage Name" = _t]), #"Added Custom" = Table.AddColumn(Source, "Week #", each Int16.From(Text.Replace([Snap_week],"week",""))) in #"Added Custom"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".
lbendlin
Super User
4 years agoAdd another column with the numeric week value, and then sort your Snap_week column by the new column.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hdFBC4IwGMbxrzI8G23TTesWdqy0oDyYh5ErJNlEZ+G3b3mJXkFv/8vvZTzLMsfb7qPTIk4SQgjl3jqV8omI4zrvIbCtqNKtLFCqlZO7QPgrIMJpwAIMwMrGRVRlIYxEcV3rxnSqNP2Icp8Bym2cVSGb1ghVTGLmcYCD30N3ujVjEQZAsFkRAuHNCQrn820c5EOb8jvHtcOYcjScWEZamUbcDEKbum70S1TjewxORKa/I6BwFmrj2Nn/uPf/g+Yf", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Funnel_Id = _t, Snap_week = _t, #"Stage Name" = _t]),
#"Added Custom" = Table.AddColumn(Source, "Week #", each Int16.From(Text.Replace([Snap_week],"week","")))
in
#"Added Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".