Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
COUNT({<vehicleStatus={0}>} vehicleStatus)
I have this expression and I just need to know that count's average.
I've tried:
AVG(COUNT({<vehicleStatus={0}>} vehicleStatus)) = wrong result.
avg(aggr(COUNT({<vehicleStatus={0}>} vehicleStatus),vehicleStatus)) -wrong result.
This is just for a KPI.
How can I do this?
Hi,
What are you trying to show here? Maybe you can give us some of you data, because right now your result will always be 1.
Say your data looks like this:
vehicleStatus |
0 |
0 |
0 |
1 |
1 |
Assume your calculation:
COUNT({<vehicleStatus={0}>} vehicleStatus)
Result will be 3
But taking an average of this will always be one. Since count is equal to the number of rows.
Jordy
Climber
You need to specify which dimension you need to get the average by, if you aggregate on the same dimension as @JordyWegman pointed out, the result will always be incorrect
If you want to take an average for all States/Cities for example, then specify as below
=Avg(aggr(COUNT({<vehicleStatus={0}>} vehicleStatus),STATE))
This is what the results of aggr look like
Hello,
So i have these fields:
dealer, country, vehicleStatus, currentPrice.
vehicleStatus contains : 0,1,2,3,4,5,6,7,8,9,10,11,12. (0=Online) (1,2,3,4,5,6,7,8,9,10,11,12 = Sold)
dealer contains : names of dealers.
country contains : countries from europe.
currentPrice contains: Numeric value for price.
For the vehicleStatus, I did the formula :
COUNT({<vehicleStatus={0}>} vehicleStatus) for online cars and
COUNT({<vehicleStatus-={0}>} vehicleStatus) for sold cars.
I have KPI for the average days online, average days to sell and average price when i choose some dealer. That is all good.
Now what I need is to compare this data with the market, like i choose dealer 1 and it shows me all about him then i also get the market average for average days online, average days to sell and average price.
That is why I need the average per country, I get huge numbers, maybe i need to do so that it calculates average days a car is only between all dealers of that country selected. I will upload a image of my dashboard in front end.