Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I want to dynamically change a variable and use it to filter rows.
let
Variable = "ABC",
Source = anything,
#"Filtered Rows" = Table.SelectRows(source, each Text.Contains([FilterColumn], "ABC") )
in
#"Filtered Rows"
works where [FilterColumn] is a column returned in the source query.
What I want to do is something like:
#"Filtered Rows" = Table.SelectRows(source, each Text.Contains([FilterColumn], Variable) )
so I can change the variable based on something else and get different results.
However, nothing I try seems to work. There must be a way to dynamically build an expression.
Amy Ideas?
Solved! Go to Solution.
How are you applying it ?
I just tried it with a custom column and it worked.
let _variable = "A" in
Table.SelectRows(#"Changed Type", each Text.Contains([Value], _variable))
How are you applying it ?
I just tried it with a custom column and it worked.
let _variable = "A" in
Table.SelectRows(#"Changed Type", each Text.Contains([Value], _variable))
I was trying to build part of the expression in the variable but, once I saw your post, it seemed obvious.
Thanks
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
9 | |
8 | |
7 | |
7 |