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.
Hola
Tengo la columna Mes Año en 2022-Enero, 2022-Marzo este formato
Cuando saco esta columna en Matrix, entonces quiero ordenar esta columna de desc a asc
Hi, @bilalkhokar73 ,
Puede agregar una columna de índice ordenada por año-mes.
1.agregar índice en power query.group
2.ordenar
3.agregar columna de índice y expandirla.
A continuación, ordene por columna de índice.
El espectáculo final:
let
Source = Excel.Workbook(File.Contents("C:\Program Files\Microsoft Power BI Desktop\bin\SampleData\Financial Sample.xlsx"), null, true),
financials_Table = Source{[Item="financials",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(financials_Table,{{"Segment", type text}, {"Country", type text}, {"Product", type text}, {"Discount Band", type text}, {"Units Sold", type number}, {"Manufacturing Price", Int64.Type}, {"Sale Price", Int64.Type}, {"Gross Sales", type number}, {"Discounts", type number}, {" Sales", type number}, {"COGS", type number}, {"Profit", type number}, {"Date", type date}, {"Month Number", Int64.Type}, {"Month Name", type text}, {"Year", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Y-month", each Date.ToText([Date],"yyyy-MMM")),
#"Grouped Rows" = Table.Group(#"Added Custom", {"Year", "Month Number"}, {{"A", each _, type table [Segment=nullable text, Country=nullable text, Product=nullable text, Discount Band=nullable text, Units Sold=nullable number, Manufacturing Price=nullable number, Sale Price=nullable number, Gross Sales=nullable number, Discounts=nullable number, #" Sales"=nullable number, COGS=nullable number, Profit=nullable number, Date=nullable date, Month Number=nullable number, Month Name=nullable text, Year=nullable number, #"Y-month"=text]}}),
#"Sorted Rows" = Table.Sort(#"Grouped Rows",{{"Year", Order.Descending}, {"Month Number", Order.Descending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type),
#"Expanded A" = Table.ExpandTableColumn(#"Added Index", "A", {"Segment", "Country", "Product", "Discount Band", "Units Sold", "Manufacturing Price", "Sale Price", "Gross Sales", "Discounts", " Sales", "COGS", "Profit", "Date", "Y-month"}, {"Segment", "Country", "Product", "Discount Band", "Units Sold", "Manufacturing Price", "Sale Price", "Gross Sales", "Discounts", " Sales", "COGS", "Profit", "Date", "Y-month"})
in
#"Expanded A"
Saludos
Equipo de soporte de la comunidad _ Yalan Wu
Si esta publicación ayuda, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla más rápidamente.
Hola
Cree una columna personalizada con Date.ToText([Date], "aaaaMM") y use esta columna para ordenar la columna Mes Año
Pls referirse a:
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |