How to create an average line in a bar chart?
I'm trying to create a dynamic average line in a bar chart on Sisense (orange line).
My sample data looks like the below. Is there a way for Sisense to calculate the average of all teams by default (i.e. $305K) and then display the orange line on the bar chart? In addition, if the user only filters to 2 teams e.g. Boston Red Sox and New York Yankees, the average would be changed to $135K and the line would automatically changed to $135K?
Attached is my sample data and chart in excel
lalasisi
Posted 2 years ago·Last reply 2 years ago
4 comments
Angelina_QBeeQ
·2 years ago · EditedHi lalasisi ,
You can add aggregation by teams like in the formula:
Just take you base formula (sum([Quantity]) - in my case) and put it inside AVG([Condition],formula).
And replace [Condition] with the column with teams.
More about aggregation you can find here: https://docs.sisense.com/main/SisenseLinux/build-formulas.htm
Always here to help,
Angelina from QBeeQ
angelina.bulgakova@qbeeq.io
QBeeQ - Gold Implementation and Development Partner
lalasisi
OP2 years agoThanks for your reply! It's in the right direction but the formula you shown isn't correct. I followed the documentation to create the correct formula and it worked now.
Helena Ferreira
·2 years agoHi lalasisi ,
You can achieve this by creating a line chart, adding an additional measure that will calculate the average, and changing the chart type for the Cost to column.
Here is the formula to get the average:
And the final result:
Please let me know if this works for you : )
Always here to help,
Helena from QBeeQ
helena.ferreira@qbeeq.io
QBeeQ - Gold Implementation and Development Partner
lalasisi
OP2 years agoThanks for your reply! It's in the right direction but the formula you shown isn't correct. I followed the documentation to create the correct formula and it worked now. https://docs.sisense.com/main/SisenseLinux/build-formulas.htm