The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a parameter which decides which column to select from a table. If the parametet value is "A", "Column1" should e selected and if the parametet value is "B", "Column2" should e selected . Can I do this with Table.SelectColumns in M code?
Hi @AJose
What do you mean by "which column to select from a table"?
Does it mean selecting different columns from table to used in a visual or to used in a formula(measure/calculated column)?
Could you show more details?
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Let me explain the the problem in detail. I am loading data from SharePoint List to Power BI and trying to create a Power BI template. I have defined certain parameters in Power BI using 'Manage Parameters' feature. I need to select the columns from the datasource based on the parameter values . I am using Table.SelectColumns (M Query) to select columns. Is there a way that I can use
1. if statement in Table.SelectColumns like if Parameter value = "A" then column1 else column2. or
2. call a custom function in Table.SelectColumns which will retrun the column name based on the parameter value
Hi @AJose
It is possible to use parameter to select data from data source.
Passing parameters to queries in Power Query
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
11 | |
7 | |
5 | |
5 | |
4 |
User | Count |
---|---|
16 | |
14 | |
8 | |
6 | |
6 |