Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi,
I want to get a new data source, I only want to get the rows that have a matching value to what is in my Materials list (which is a text string). However, i'm not able to access the string of Materials via a variable in the SQL statement.
Anyone know what I'm missing?
Solved! Go to Solution.
@CMN1BL Hi! In this case, you cannot directly use it as a list in a raw SQL query within Power BI. However, you can make it as a step after the source step, like:
let
Source = Sql.Database("YourServerName", "YourDatabaseName", [Query = "SELECT * FROM YourTable"]),
// Use the existing 'Materials' variable
TrimmedMaterials = List.Transform(Text.Split(Materials, ", "), each Text.Trim(Text.Replace(_, "'", ""))), // Convert the string to a list and clean it up
FilteredRows = Table.SelectRows(Source, each List.Contains(TrimmedMaterials, [Material])) // Filter the rows
in
FilteredRows
BBF
@CMN1BL Hi! In this case, you cannot directly use it as a list in a raw SQL query within Power BI. However, you can make it as a step after the source step, like:
let
Source = Sql.Database("YourServerName", "YourDatabaseName", [Query = "SELECT * FROM YourTable"]),
// Use the existing 'Materials' variable
TrimmedMaterials = List.Transform(Text.Split(Materials, ", "), each Text.Trim(Text.Replace(_, "'", ""))), // Convert the string to a list and clean it up
FilteredRows = Table.SelectRows(Source, each List.Contains(TrimmedMaterials, [Material])) // Filter the rows
in
FilteredRows
BBF
Thank you BBF!🙏
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 13 | |
| 11 | |
| 10 | |
| 9 | |
| 6 |