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.
I have a query with several columns and want to filter it dynamicly removing last 3 "Week id" from a column.
Product Week id
X 1
Y 1
Z 2
X 4
Z 4
Z 5
Y 7
The output should look like this:
Product Week id
X 1
Y 1
Z 2
X 4
Z 4
Weeks, 7,6,5 was removed. Although there was no data for week id = 6 it should be counted.
I would have this in PQ.
Thanks in advance
Solved! Go to Solution.
try this code
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WilDSUTJUitWJVoqEs6KALCMwCyRrAhdDsEzhOsyVYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Tab = _t, WeekId = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Tab", type text}, {"WeekId", Int64.Type}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [WeekId] < List.Max(#"Changed Type"[WeekId])-2) in #"Filtered Rows"
for your application you should use the last line and replace the blue parts with names specific to your setup
try this code
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WilDSUTJUitWJVoqEs6KALCMwCyRrAhdDsEzhOsyVYmMB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Tab = _t, WeekId = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Tab", type text}, {"WeekId", Int64.Type}}), #"Filtered Rows" = Table.SelectRows(#"Changed Type", each [WeekId] < List.Max(#"Changed Type"[WeekId])-2) in #"Filtered Rows"
for your application you should use the last line and replace the blue parts with names specific to your setup
Thanks for clear answer. Works Great!
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 |
---|---|
110 | |
97 | |
77 | |
63 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |