Forum Discussion
Dynamic String Format
- 1 year ago
Hi SuryaDave
Just to help further (and in case it’s helpful for anyone else referencing this thread), I’ve created a sample.pbixfile that demonstrates the SELECTEDVALUE pattern
Hope it helps!!
Hi SuryaDave
Just following up regarding your question about using dynamic string formatting in Power BI , thanks for sharing the sample file and context!
You're currently using the latest Power BI Desktop and working with a file hosted on your Premium cloud server. In your example, you’ve manually hardcoded the metric names and formats using SELECTED VALUE for just two measures one numeric and one percentage. That works fine for small cases, but as you mentioned, managing this manually for 180+ KPI metrics would be extremely difficult.
Your idea of creating a table (either inside Power BI or externally) to store KPI names and their corresponding formats is absolutely on the right track!
You can then use DAX to dynamically reference this table and apply the correct format string based on the selected KPI.
Let me know if you’d like to explore that further!
Thanks again for being such an engaged member of the Microsoft Fabric Community
Hi SuryaDave
I wanted to follow up regarding your inquiry about using dynamic string formatting in Power BI. Thank you for sharing the sample file and providing context!
I see that you're using the latest version of Power BI Desktop and working with a file hosted on your Premium cloud server. In your example, you've hardcoded the metric names and formats using SELECTED VALUE for just two measures one numeric and one percentage. While this approach works for a small number of cases, I understand that managing it manually for over 180 KPI metrics would be quite challenging.
Your suggestion to create a table (either within Power BI or externally) to store KPI names along with their corresponding formats is an excellent idea!
You can utilize DAX to dynamically reference this table and apply the appropriate format string based on the selected KPI.
If you still facing issue , I’d be happy to help you explore this further!
Thank you once again for being such an active member of the Microsoft Fabric Community!