The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
The image below shows: Product 1, Product 10, Product 100. But I want you to order and stay: Product 1, Product 2, Product 3 ...
Hi FABRICIOWF12,
You could try below M code to create column, then click [Name] column to set Sort by.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKlAwVIrVAdFGUNoYSptAaUMDpdhYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [name = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"name", type text}}),
#"Duplicated Column" = Table.DuplicateColumn(#"Changed Type", "name", "name - Copy"),
#"Removed Columns" = Table.RemoveColumns(#"Duplicated Column",{"name - Copy"}),
#"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each Text.Combine(List.RemoveNulls(List.Transform(Text.ToList([name]),each if Value.Is(Value.FromText(_), type number) then _ else null)))),
#"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Custom", Int64.Type}})
in
#"Changed Type1"
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Put your table in the order you wish it to be, add an index column, and then sort the product column by that index column. The same applies to sorting Month Names.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
if you're unable to put the table in a desired order (which the above index suggestion solves very easily)...then you can also try chopping up the produto column and separate the name from the number. For example:
Duplicate the product name column, and then modify the duplicated column to replace values (right mouse click on the column) and in the "Value to find" cell, enter "Producto " and for the "Replace with" cell, leave it blank. You'll then have the product number only associated with the full product name. then you can change that column to a whole number, and then sort from smallest to biggest. That should do it too.