Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
548 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Dynamic Measure Formatting |
---|
When using more complex measures there may be a need for each to be formatted differently. This blog shows you how to use the dynamic formatting measure feature. |
When creating a measure you may want to apply different formatting to different parts of the calculation.
Here I have a measure that returns a SUM when the FamilyName column is applying a filter, and an AVERAGE when the FamilyName column isn't applying a filter.
You can use the ISFILTERED function to test if a column is applying a filter.
When you add this measure to a table visual along with the FamilyName column, you'll see the average on the total row and the sum on all the other rows.
The Total row is not filtered by the FamilyName column, so it shows the average.
In the table above, the measure has the same formatting on every row. We don't need to display decimal places on the rows which display a sum as these are all whole numbers.
To control this, we can apply dynamic formatting to the measure. To do this, select the measure and on the Measure tools tab of the ribbon, change the Format to Dynamic.
Choose this option to create a dynamic format for the measure.
Choosing to create a Dynamic format allows you to write DAX code in the formula bar to apply formatting to the measure. You can switch between the different views of the measure using the drop down list next to the formula bar.
You can choose Measure to see the original code.
Now you can write some code to choose which parts to format and how.
You don't need to include a measure name, this isn't a measure!
You can read more about creating custom format strings and which symbols you can use here.
Press Enter and admire your nicely formatted visual.
Now you can do some conditional formatting!
Some other pages relevant to the above blog include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.