简体   繁体   中英

How to use only certain number of rows per category for calculation?

I do a simple project where I calculate how many times a ball in casino roulette game lands in each pocket after after 20000 spins.

I have data for 2 different roulette tables with approx 10k spin results for each. I count a number of occurrences of each result which is fine. The problem arises when I want to limit the calculation to lets say 5k results (rows of data) for each category (Roulette name in this case) and see how many times the ball land in each pocket after 5k spins.

How do I limit how many rows of data per each category do I pass to COUNT() function? Example of my wb as an img

Try this:

You will have to add a pk field for each of your results so your pk will be 1-10000 or however many records you have.

Parameter Setup:

参数设置

Choose pk from the Set From Field options

Create a calculated field named N Results

N Results :

IF (pk - 1) < [View for N Results] THEN [result] END

Add N Results to your filter shelf and Exclude NULL . Show View for N Results parameter and type in a value. Your grand total should now equal the parameter value.

Final Layout:

最终的

Let me know how that turns out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM