I am stuck trying to get more flexibility in my queries.
I have facts table:
| enabled | country | color | count | vehicle |
|---|---|---|---|---|
| yes | DE | yellow | one | car |
| no | FR | blue | one | car |
| no | DE | red | one | bike |
| yes | DE | green | one | car |
| yes | ES | yellow | one | car |
| yes | IT | yellow | two | car |
| yes | IT | yellow | one | car |
and in Excel I also would like to have two simple configuration tables:
- Table: RemoveRecordsByValue a table with field-value pairs, that act as conditions to remove those records if there is any match.
| field | value |
|---|---|
| vehicle | bike |
| color | green |
| color | red |
- Table: KeepRecordsByValue a table with potentially
| field | value |
|---|---|
| country | DE |
| country | IT |
| count | one |
The expected table would be:
| enabled | country | color | count | vehicle |
|---|---|---|---|---|
| yes | DE | yellow | one | car |
| yes | IT | yellow | one | car |
Anybody might have a hint how to solve this?
Thanks in advance,
***FactsTable***
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqkwtVtJRcnEFEpWpOTn55UBGfl4qkExOLFKK1YlWyssHctyCgERSTmkqdmmw/qLUFLhsUmZ2Klgayfz0otTUPAz9EAWuwbgdAFHhGYKsoqQ8n4AKJDNiAQ==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [enabled = _t, country = _t, color = _t, count = _t, vehicle = _t]),
Result = Table.TransformColumnTypes(Source,{{"enabled", type text}, {"country", type text}, {"color", type text}, {"count", type text}, {"vehicle", type text}})
in
Result
***RemoveRecordsByValue***
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WKkvNyEzOSVXSUUrKzE5VitWJVkrOz8kvAgqkF6Wm5qGIFKWmKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [field = _t, value = _t]),
Result = Table.TransformColumnTypes(Source,{{"field", type text}, {"value", type text}})
in
Result
***KeepRecordsByValue***
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSs4vzSspqlTSUXJxVYrVQRbwDEEIALn5ealKsbEA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [field = _t, value = _t]),
Result = Table.TransformColumnTypes(Source,{{"field", type text}, {"value", type text}})
in
Result
´´´



