Forum Discussion
sslavin
8 years agoNew Member
How to conditionally filter a column in Power Query
I have a table in Excel I am extracting rows from user Power Query. I also have an input cell on the output worksheet where a user can enter a value to filter the results. I have successfully set th...
- 8 years ago
You can add a step with a condition like this:
if MyParameter <> null then PreviousFilteredStep else PrePreviousUnfilteredStep
ImkeF
8 years agoCommunity Champion
You can add a step with a condition like this:
if MyParameter <> null then PreviousFilteredStep else PrePreviousUnfilteredStep
reubster
7 years agoFrequent Visitor
I was just trying to figure out how to do this best myself, and found this reply.
I am wondering whether declaring it this way will actually lead to the filter in the previous step being executed, and then the conditional parameter line evaluated? Or whether the mashup engine is smart enough to postpone evaluating the filter until it knows it needs to?
I'm writing mine as;
if MyParameter <> null then ( .. filter expression ) else previousunfilteredstep
... just in case
?
- ImkeF7 years agoCommunity Champion
Yes, M is a partially lazy language. So it will mostly only evaluate what's actually needed.