Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hello lovely people,
Can I please have some advice on how to set my Query to ONLY keep the latest month's entry, which would be the latest date in Col C.
e.g. For month of Aug, we only need to keep the yellow highlighted row 6 (04/08/2023), row 1 to 5 can be removed.
Thank you!
Solved! Go to Solution.
Thanks so much! I think I just figured it out:
We need to sort table 2 times before using Remove duplicates.
Sort Column B, if there are more than one Project in Column B;
Make sure your date column is formatted as date and Excel recognize them as date. Otherwise sorting on Date Column won't work;
Sort the whole table by Date column from Newest to Oldest.
Only select "Project Name" column which holds the criteria to check for duplicates, then use Remove duplicates.
Excel always keeps the first data set of a duplicated row. All consecutive rows can be removed
Thanks so much! I think I just figured it out:
We need to sort table 2 times before using Remove duplicates.
Sort Column B, if there are more than one Project in Column B;
Make sure your date column is formatted as date and Excel recognize them as date. Otherwise sorting on Date Column won't work;
Sort the whole table by Date column from Newest to Oldest.
Only select "Project Name" column which holds the criteria to check for duplicates, then use Remove duplicates.
Excel always keeps the first data set of a duplicated row. All consecutive rows can be removed
use List.Max()
let
Source = Excel.CurrentWorkbook(),
Table1 = Source{[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Table1,{{"region", type text}, {"project name", type text}, {"date of change", type date}, {"amount", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", let latest = List.Max(#"Changed Type"[date of change]) in each [date of change] = latest)
in
#"Filtered Rows"
Use Date.IsInCurrentMonth to filter your rows. Sample soluton below
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcgxwdFbSUXIsLcnPTSzJzM8Dckz0zfSNDIyMQUxTpVgdXKqMLGDKjI1wKjPVh6syt8CpylzfFG6WsTFOZRb6JjBlpma4nWahbwj3gRHQabEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Region = _t, #"Project Name" = _t, #"Date of Change" = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Region", type text}, {"Project Name", type text}, {"Date of Change", type date}, {"Amount", Int64.Type}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each (Date.IsInCurrentMonth([Date of Change])))
in
#"Filtered Rows"
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 5 | |
| 4 |