Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
_Thomas_
Contributor
Contributor

Get counts of calculated meaure in a table

Hi,

I've made a table like this. I want to add a third column that contain counts of the second column (In this case, from top to bottom that would be: 1,6,6,6,6,6,6,11,11,11,11,11,11,11,11,11,11,11). What expression can I use to accomplish this?

clipboard_image_0.png

6 Replies
DavidM
Partner - Creator II
Partner - Creator II

I think count(distinct(round(response/100))) should work

asinha1991
Creator III
Creator III

remove second expression as measure, create a new dimension(not measure) as round(response/100)

create a third measure as sum(aggr(count(1), round(response/100))

check it works

StarinieriG
Partner - Specialist
Partner - Specialist

If you could create a new dimension like:

Round((response)/100) as response_aggr

Your expression will be: 

Count(total <response_aggr> response)

_Thomas_
Contributor
Contributor
Author

This is along the lines of what I want, but it produces a column of all 1's

As for the other answers, I wish to do this all in a single measure if possible. In my actual app, the '100' is not fixed. It will be many different values for different chart objects so solving this with a new dimension in the data model is not a viable option. 

asinha1991
Creator III
Creator III

Did you check if adding this in measure sum(aggr(count(1), round(response/100)) works?  Just take one dimension I.e response.. I am guessing this should

_Thomas_
Contributor
Contributor
Author

This produces a column of all 0s. I think this might be close though.