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.
I can filter my data using the following code in the advanced editor:
#"Filtered Rows" = Table.SelectRows(#"Previous step", each true)
Of course, nothing will happen there. What I would like to do now is to create a parameter (let's call it ParamFilter) where I could store the actual filter definition:
"([Column1] > 5 and [Column2] < 2)" meta [IsParameterQuery=true, Type="Any", IsParameterQueryRequired=false]
Now I want use that parameter content to do the actual filtering. This here will throw an error:
#"Filtered Rows" = Table.SelectRows(#"Previous step", each ParamFilter)
Which was obvious because it would be interpreted like this, mind the quotation marks:
#"Filtered Rows" = Table.SelectRows(#"Previous step", each "([Column1] > 5 and [Column2] < 2)")
I actually wanted to achieve this:
#"Filtered Rows" = Table.SelectRows(#"Previous step", each ([Column1] > 5 and [Column2] < 2))
So, how can I manage that? Any ideas?
Solved! Go to Solution.
Solved it myself after browsing the M reference again for anything related. There is the Expression.Evaluate() function. This will work:
#"Filtered Rows" = Table.SelectRows(#"Previous step", Expression.Evaluate(ParamFilter))
The each statement needs to go to the parameter value:
"each ([Column1] > 5 and [Column2] < 2)" meta [IsParameterQuery=true, Type="Any", IsParameterQueryRequired=false]
Solved it myself after browsing the M reference again for anything related. There is the Expression.Evaluate() function. This will work:
#"Filtered Rows" = Table.SelectRows(#"Previous step", Expression.Evaluate(ParamFilter))
The each statement needs to go to the parameter value:
"each ([Column1] > 5 and [Column2] < 2)" meta [IsParameterQuery=true, Type="Any", IsParameterQueryRequired=false]
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 |
---|---|
101 | |
50 | |
19 | |
12 | |
11 |