Forum Discussion
Power Query - removing all columns with no values?
- Anonymous10 years ago
Hi igaca,
Based on my understanding, you want to remove the null value column with power query, right?
If as I said, you could follow below steps:
1. Create a test table, and load it to power bi, click 'edit query'.
2. Select all of the table and click the ‘Unpivoted Columns’.
3. Choose the first Column and click ‘Removed duplicates’, then modify the query to remove the second column.
Modify:
Table.Distinct(#"Unpivoted Columns", {"Attribute"}) => Table.Distinct(#"Unpivoted Columns", {"Attribute"}) [Attribute]
4. Click on ‘fx’ to add a custom step:
Use Table.SelectCoulmns function to get the specify columns:
For more detail info, you could refer to below link:
Video_017 How to Remove Null Columns with Power Query?
Regards,
Xiaoxin Sheng
ImkeF wrote:Pls try this:
let Source = Oracle.Database("ORACLSQL", [HierarchicalNavigation=true]), PO = Source{[Schema="PO"]}[Data], PO_REQUISITION_HEADERS_ALL1 = PO{[Name="PO_REQUISITION_HEADERS_ALL"]}[Data], Custom1 = FnRemoveEmptyColumns(PO_REQUISITION_HEADERS_ALL1) in Custom1... you need to pass an argument to the function
yep. thanks for the help.
Any trick to exclude headers?
Right now all the columns have a header, but I want eliminate these columns with no data in it.
Not sure if I understood you, but maybe this is what you'e looking for:
let
Source = Oracle.Database("ORACLSQL", [HierarchicalNavigation=true]),
PO = Source{[Schema="PO"]}[Data],
PO_REQUISITION_HEADERS_ALL1 = PO{[Name="PO_REQUISITION_HEADERS_ALL"]}[Data],
Custom1 = FnRemoveEmptyColumns(Table.PromoteHeaders(PO_REQUISITION_HEADERS_ALL1))
in
Custom1
- Tow8 years agoFrequent Visitor
Ok, during the query is fine.
But what, if I want them to be removed, only if the context of the user filtering reveals, that the columns got just null rows?
Is there an idea, how to handle that?