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.
Hi everyone,
I have a table with 30 columns, say C1...C30. And need to create a dashboard where a user can use slicer to pick which column to sum, and output it on a graph. E.g. when user selects C7 on slicer, then the graph plots a sum of column [C7].
I know one way to achieve this is to create 30 measures and use SWITCH() function. But is there a way to create just single measure and reference column name with a variable?
Thank you!
Solved! Go to Solution.
If you're able to use the query editor, select C1...C30 and click unpivot columns. That'll allow you to easily do it with one calculation.
You should also be able to use the UNION function in DAX, see below for an example
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
If you're able to use the query editor, select C1...C30 and click unpivot columns. That'll allow you to easily do it with one calculation.
You should also be able to use the UNION function in DAX, see below for an example
https://stackoverflow.com/questions/50213905/is-it-possible-to-unpivot-in-power-bi-using-dax