Jump to content

Custom Expression with OVER() not recalculating for filters

Amy Hillecke

Recommended Posts

I am making a pie chart that shows what percentage people scored high within the filtered date. The data looks about like this:

Person | DATE | HighScore

Person1 | 1/1/21 | No

Person1 | 1/2/21 | No

Person1 | 1/3/21 | Yes

Person1 | 1/4/21 | No

Person1 | 1/5/21 | Yes

Person2 | 1/2/21 | Yes

Person3 | 1/2/21 | No

Person3 | 1/5/21 | No

Person4 | 1/4/21 | Yes

Person4 | 1/5/21 | No

When all of the dates are selected, it should show that 75% are Yes (persons 1, 2, and 4), 25% are No (person3). I seem to be getting this correct by setting the ColorBy: custom expression to . And setting the Sector Size to UniqueCount([Person])

But, if the [Date] filter is limited to days 1 and 2, I want it to show 33% Yes (person 2 only), and 67% No (person 3, plus person1 who hadn't yet scored high) Right now, all it seems to get right is dropping Person4 from the data. It still evaluates person1 as being on the Yes sector, despite that date being outside of the selected data. I tried adding AllPrevious([Date]) to the expression, but then it was counting person1 in both sectors because for the first two days they were No, then Yes thereafter.

Is there something I can add to the custom expression so it only evaluates on the filtered rows

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...