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
I have a column in which the values are given as "list" and "record", I cannot pre filter it, the data is given me as such.
I would need to be able to filter out lists and records, how can i do that ?
I thought of making a custom column that gives if the line is a list or a record in text so i can filter out, if their a way to do it ?
Solved! Go to Solution.
Hi @Anonymous ,
Please refer to my code and sample.
Whole M Code:
let
Source = Table.Combine({Table, List, Record}),
#"Added Custom" = Table.AddColumn(Source, "Custom.1", each Table.SelectRows([Custom])[Column1]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Custom.1"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns", "Table", each if
Table.ColumnCount([Custom]) <> Error.Record
then
"Table"
else
"Record"),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "List", each if
List.Count([Custom]) <> Error.Record
then
"List"
else
""),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Record", each if
Record.ToList([Custom]) <> Error.Record
then
"Record"
else
""),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Added Custom3", {{"Table", ""}}),
#"Replaced Errors1" = Table.ReplaceErrorValues(#"Replaced Errors", {{"List", ""}}),
#"Replaced Errors2" = Table.ReplaceErrorValues(#"Replaced Errors1", {{"Record", ""}}),
#"Added Custom4" = Table.AddColumn(#"Replaced Errors2", "Combine", each if [Table] = ""
then
if [List] = ""
then
[Record]
else
[List]
else
[Table])
in
#"Added Custom4"
Result is as below.
I think [Combine] column is the result you need.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
Go to power query edtior and filter that data!
Proud to be a Super User!
I am already on power query, my problem is that i want to filter out the data but i cannot as power query refuses to consider lines showing as "List" and "Record" lines as filter targets
Hi @Anonymous ,
Please refer to my code and sample.
Whole M Code:
let
Source = Table.Combine({Table, List, Record}),
#"Added Custom" = Table.AddColumn(Source, "Custom.1", each Table.SelectRows([Custom])[Column1]),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Custom.1"}),
#"Added Custom1" = Table.AddColumn(#"Removed Columns", "Table", each if
Table.ColumnCount([Custom]) <> Error.Record
then
"Table"
else
"Record"),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "List", each if
List.Count([Custom]) <> Error.Record
then
"List"
else
""),
#"Added Custom3" = Table.AddColumn(#"Added Custom2", "Record", each if
Record.ToList([Custom]) <> Error.Record
then
"Record"
else
""),
#"Replaced Errors" = Table.ReplaceErrorValues(#"Added Custom3", {{"Table", ""}}),
#"Replaced Errors1" = Table.ReplaceErrorValues(#"Replaced Errors", {{"List", ""}}),
#"Replaced Errors2" = Table.ReplaceErrorValues(#"Replaced Errors1", {{"Record", ""}}),
#"Added Custom4" = Table.AddColumn(#"Replaced Errors2", "Combine", each if [Table] = ""
then
if [List] = ""
then
[Record]
else
[List]
else
[Table])
in
#"Added Custom4"
Result is as below.
I think [Combine] column is the result you need.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous Question is not clear , if you can filter with custom column why cant you filter when the data is in the raw format. what is the business logic
Proud to be a Super User!
I cannot i do not have access to the raw data, it is given me as such via an api
Is there a function that would give something like "If column is a record type then "record", else "list" ?
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |