Forum Discussion

Les111's avatar
Les111
Resolver I
4 years ago
Solved

Format values when using dynamic metrics and dimensions

I have a chart where the user can select both metric and dimension in slicers, e.g there are metrics for appointments and DNA %. These metrics are displayed dynamically based on a DAX measure which s...
  • Les111's avatar
    4 years ago

    Well, as often happens, I worked this out myself soon after posting this, and with a bit of help from this video: Dynamic NUMBER FORMATTING using CALCULATION GROUPS in Power BI - YouTube

     

    To fix this I added a format column to my metrics table (values are 0 for number metrics and #0.0% for percentages). Then I created a new calculation group with just one item called format, which has the expression SELECTEDMEASURE() and the format string expression is SELECTEDVALUE(Metrics[Format]). 

     

    Finally I added a filter to the chart, which is the 'name' field from the calculation group and selected the column in it.