Forum Discussion
Slicer that changes calculations within visuals
Hello all,
I have data of calls for their duration stretching over a range of days. Currently, I am displaying the data to show the total number of calls for each day of the week as below:
Right now, it shows the total number of calls. I know how to change the column values to show the average calls per day, but I'm interested in adding a slicer to the side with the "Total" and "Average" options that, when selected changes the calculation in the visual automatically. Is this possible?
3 Replies
- parry2k
Super User
Anonymous yes that is possible, create a table using following DAX under modelling tab, clicking Data Table
Aggregation Selection = DATATABLE( "Aggregation Method", STRING, { { "Average" }, { "Sum" } } )it will create a table in your model, drop "Aggregation Method" from this table in a slicer and add a measure or change existing
Calls by Aggregation Method = VAR __aggregationMethod = SELECTEDVALUE( 'Aggregate Selection'[Aggregation Method], "Sum" ) RETURN IF ( __aggregationMethod = "SUM", <sum measure>, <average measure> )
- AnonymousNot applicable
parry2kI forgot to mention that when averaging, I have other visuals that need to average the call duration by call hour of the day (24 hour clock), and also by caller ID. So I'm not sure if creating a measure is the best to average all the visuals simulatenously. Your solution, however works if there was only one visual.
- parry2k
Super User
You can create avg and sun measures and use those wherever you want and the same measure use in this if condition.