Forum Discussion
Dynamic Column Selection With Mandatory (always selected) column for ID
- 1 year ago
Hi ASMParDA,
Thanks for your detailed explanation and examples and it really helped in reproducing the scenario.I’ve implemented your requirement in Power BI using field parameters and a custom DAX measure to conditionally show rows based on whether the selected columns contain non-blank values for each Unique ID. The Unique ID column remains fixed in the visual, and only rows with at least one non-blank value in the selected fields are displayed.
Example Outcomes (as requested):
- If the user selects order quantity and delivered quantity, rows with non-blank values in either of those are shown.
- If the user selects sales volume and sales value, only rows with data in those fields are shown.
For your reference, I’m attaching the working .pbix file so you can explore the implementation directly.
If this information is helpful, please “Accept as solution” and give a "kudos" to assist other community members in resolving similar issues more efficiently.
Thank you.
Hi ASMParDA ,
This is a great use case and yeah, field parameters don’t allow repeating the same column (like ID) twice — but there’s a clean workaround using a combination of field parameters and a calculated table.
Here’s how you can approach it:
Create a field parameter with only the optional columns (A, B, C, D etc). Don’t include ID here.
Then create a calculated table like this:
CombinedFields =
UNION(
SELECTCOLUMNS(VALUES('YourTable'[ID]), "Field", "ID"),
SELECTCOLUMNS('Field Parameters', "Field", 'Field Parameters'[Name])
)- Use this CombinedFields table in your visual. This way, ID is always included, and the rest are dynamic based on slicer selection.
Alternatively, if you’re using a matrix visual, you can:
- Add ID as a fixed row or column
- Use the field parameter only for the dynamic part
If you’re open to using Calculation Groups, that can work too, but it’s a bit more complex to maintain and doesn’t always play well with slicers.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
translation and formatting supported by AI