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.
Hello all,
I've spent the last two days reading through this forum trying to find an answer, but all the similar questions have been for slicers with just a few options.
An executive has requested that I create a line graph of actual metric values (like sales by month) next to a slicer containing all of our company metrics - there are over 300 metrics. The line graph would show just the one selected column from the slicer at a time. Every solution I've read has used SWITCH or hand coded a disconnected table.
I've tried 20+ variations of code, including below. I have one table (Dynamic Metric List) with one column that just lists the metrics (Metric List), and one table (Flat Data) with totally normalized metric values where each metric is its own column. :
Dynamic Display =
VAR MySelection = SELECTEDVALUE('Dynamic Metric List'[Metric List])
RETURN
SWITCH(TRUE(), MySelection = "Adjusted EBITDA", 'Flat Data'[Adjusted EBITDA], MySelection="Bad Debt", 'Flat Data'[Bad Debt], 'Flat Data'[Adjusted EBITDA])
The code above compiles, but isn't giving me the correct values or even letting me switch between the 2 example metrics (Adjusted EBITDA & Bad Debt).
How can I create a giant slicer that dynamically changes the column in my line graph?
We've only recently implemented Power BI, so it's important for this to work soon.
Thanks in advance, I really appreciate it.
HI @acornell,
It is hard to create a measure with more than 300 columns with switch function to achieve dynamic choose.
On my opinion, I'd like to suggest you to unpivot columns to transform your data to attribute and value, then you can simply create visualization to achieve dynamic filter effect.
Unpivot Data Using Excel Power Query
Regards,
Xiaoxin Sheng