Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 selects whichever one is selected in the slicer.
The dimension, (e.g. age group, ethnicity etc) is selected in another slicer which is populated by a calculation group, with an expression like this for each dimension:
CALCULATE( SELECTEDMEASURE(), USERELATIONSHIP(DimensionIndex[UniqueID], DIM_Ethnicity[UniqueID]) )
The chart looks like this and works beautifully where all the values are whole numbers, but I have a metric that is a percentage which needs to be formatted as a %:
I have tried formatting the value in the source measure and in my DAX measure that selects the metric, but this breaks the chart, and instead of showing the selected dimension in the legend it shows all the values for every dimension:
Any ideas as to how to format individual metrics in this situation?
Thanks
Leslie
Solved! Go to Solution.
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.
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.
User | Count |
---|---|
3 | |
3 | |
2 | |
1 | |
1 |
User | Count |
---|---|
9 | |
4 | |
3 | |
3 | |
2 |