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
Instead of hardcoding the metric name, you can perhaps check whether the metric name contains a certain string and return the format string based on that condition.
IF ( CONTAINSSTRING ( 'table'[metric name], "%" ), "#0.0%", "##0" )
You also use a physical table that contains the mmetric name and the format string and just simply reference the string itself. You can another to column to the table where the metric names are.
SELECTEDVALUE ( 'table'[format string] )
Thanks danextian for your response.
Apologies for very late response - I was travelling and then got busy with few urgent items.
Regarding your response - I really liked your idea of using selected value
SELECTEDVALUE ( 'table'[format string] )
However, somehow I was not able to get it to work just like that.
So what I did was created look up table - see screenshot below
I then joined then using may to one with my original table and then as last step created below format string & that is working perfectly.
danextian - can you please see if that is something that you think is a solution or you have bettter suggestion.
I will for your response & accordingly I will accept suggestion as solution to make sure that someone having the same problem can find the correct solution throught this forum.
I would also like to thanks lbendlin , Ashish_Mathur & v-aatheeque for your contribution and suggestion. Feel free to provide further input on the basis of my these post and screenshots I have attached.
Thanks
- v-aatheeque1 year ago
Community Support
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!! - danextian1 year ago
Super User
For SELECTEDVALUE (['table'[format string] ) to work string to work, it must be in the same table as those used in the visual.