Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
1. This is my Data having country column and population column
2. however i sort whether ascending or descending by population, i need total row at top.
Hi @Anonymous ,
Here I suggest you to add an index column in Power Query Editor to sort your visual.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8sxLyUxU0lEyNDJXitWJVnLOyMyD8A3AfI/8vHRvIAYJQURCg4Fscwg7JL8kMQfINTUA6o4FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Country = _t, #"Population/B" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Country", type text}, {"Population/B", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Population/B", Order.Ascending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "New Index", each if [Country] = "Total" then 1 else [Index] +1),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Index"})
in
#"Removed Columns"
New Table:
Sort [Country] by [New Index] column. Then sort visual by [Country] by ascending.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
102 | |
90 | |
80 | |
71 | |
69 |
User | Count |
---|---|
113 | |
99 | |
97 | |
72 | |
68 |