Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi Guys, I would like to know if there is a trick on changing the computation of dashboard from Average to Sum or Median to Sum via Slicer?
Thank you
Solved! Go to Solution.
Hi @Anonymous ,
Yes use this slicer on the dashboard/report. Your chart calculations will change based on the selection in the slicer. It is the same logic, you will be using a chart visual in place of a simple table visual.
I just showed you on a table visual. Try it on a line chart visual, it will work.
Thanks,
Pragati
Hi @Anonymous ,
Yes you can do this in Power BI easily by using following steps:
1. Create a simple table in Power BI using Enter Data option for different calculation types you want: (modify these based on your requirement)
You will end up with following table:
Now suppose, in my scenario I want to modify the calculation type of Sales by Category.
I will start by creating a slicer by moving Calc Type column to it: (Make sure to make the slicer Single Select as logically only one type of calculation can be shown at a point)
Now I will create a measure something as below:
Calc_Type_Sales =
var calcType = SELECTEDVALUE('Calculation Type'[Calc Type])
RETURN
SWITCH(
TRUE(),
calcType = "Sum", SUM(ClothingSales[Sales]),
calcType = "Average", AVERAGE(ClothingSales[Sales]),
MEDIAN(ClothingSales[Sales])
)
Now I will move this above measure against Category column in my data in a simple table visual:
Now start selecting the values from the slicer and the Calc_Type_Sales values changes for each category in the left table:
It shows:
So the calculation type for Sales changes based on the selection I make in the slicer on the right.
You can modify this solution to your requirement by adding other calculation types as well.
Let me know how you get on with this solution.
Thanks,
Pragati
Hi @Pragati11
That is a wonderful idea however, is it possible to use it on a dashboard, for example:
This is the average count
and this is the median:
I want the dashboard itself to switch its computation using slicer. Apologies for the confusion
Thank you in advance.
Hi @Anonymous ,
Yes use this slicer on the dashboard/report. Your chart calculations will change based on the selection in the slicer. It is the same logic, you will be using a chart visual in place of a simple table visual.
I just showed you on a table visual. Try it on a line chart visual, it will work.
Thanks,
Pragati
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 37 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 74 | |
| 72 | |
| 39 | |
| 35 | |
| 23 |