Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
143 | |
104 | |
104 | |
80 | |
66 |