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.
Hi guys,
I have a very tricky question.
Lets assume the following data table:
No Name Forname ...
1 Morgan John
2 Griffin Peter
3 Johnson John
4 ... ...
5 .... ...
Now I want to get all rows after "3 Johnson John". Problem being is that this might change in the next query dynamically. I have another table with just one entry which would be my row filter criteria with just:
3 Johnson John
This I would like to use as a parameter for the filter process of the big table.
How can I search the whole table with my row filter criteria and output all values after this specific entry in power query?
I'd love to get some ideas from you guys.
Regards.
Solved! Go to Solution.
Hi @vshala1
Please see if solution in attached file is useful
I named the table which contains rowfilter criteria as "RowFilter"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLNL0pPzAMyvPIz8pRidaKVjIAc96LMtLRMkHBAaklqEVjcGKqoOB9FuQmQE1WalAmkHIsz08BipkCOR2Ix2FygXGIm0IRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [No = _t, Name = _t, Forname = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"No", Int64.Type}, {"Name", type text}, {"Forname", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1),
Rowstoskip = Table.SelectRows(#"Added Index",each [No]=RowFilter[No]{0} and [Name]=RowFilter[Name]{0} and[Forname]=RowFilter[Forname]{0} )[Index]{0},
Custom1 = Table.Skip(#"Added Index",Rowstoskip)
in
Custom1
Hi @vshala1
Please see if solution in attached file is useful
I named the table which contains rowfilter criteria as "RowFilter"
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfLNL0pPzAMyvPIz8pRidaKVjIAc96LMtLRMkHBAaklqEVjcGKqoOB9FuQmQE1WalAmkHIsz08BipkCOR2Ix2FygXGIm0IRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [No = _t, Name = _t, Forname = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"No", Int64.Type}, {"Name", type text}, {"Forname", type text}}),
#"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1),
Rowstoskip = Table.SelectRows(#"Added Index",each [No]=RowFilter[No]{0} and [Name]=RowFilter[Name]{0} and[Forname]=RowFilter[Forname]{0} )[Index]{0},
Custom1 = Table.Skip(#"Added Index",Rowstoskip)
in
Custom1
Bascially,
1) we add index column to identify row number
2) get the index number for matching row
3) skip the rows upto that index number
Thank you so much! I am nearly there I think. The only thing is that it says "Expression.Error: The name 'RowFilter' wasn't recognized. Make sure it's spelled correctly." although I named my table "RowFilter".
Any idea?
Found it! Your solution works!
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 |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |