A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi aislamu,
Regarding your concern, you can add a Table.Sort step after filtering. You can try this:
let
Source = Excel.CurrentWorkbook(){[Name="ServiceDirectory"]}[Content],
ChangedTypes = Table.TransformColumnTypes(
Source,
{
{"City", type text},
{"Reviews", Int64.Type},
{"Rating", type number}
}
),
FilteredRows = Table.SelectRows(
ChangedTypes,
each [City] = "Columbia" and [Reviews] >= 10
),
SortedRows = Table.Sort(
FilteredRows,
{{"Rating", Order.Descending}}
)
in
SortedRows
Explanation:
- ChangedTypes ensures that Reviews and Rating are treated as numbers
- FilteredRows keeps only businesses in Columbia with at least 10 reviews
- SortedRows sorts the remaining businesses by Rating, from highest to lowest
If businesses with the same rating need to be ranked by review count, you can add a secondary sort:
SortedRows = Table.Sort(
FilteredRows,
{
{"Rating", Order.Descending},
{"Reviews", Order.Descending}
}
)
Hope this helps.