Calculating percentage in beast mode based on count

Hi, I have a dataset that looks like this:

Network     Hour     Date     Avails
A           1        1/1      2
A           2        1/2      4
B           1        1/1      6
B           2        1/2      8
C           1        1/1      10
C           2        1/2      12
C           2        1/2      12

The number of avails is the same for every row that has the same network, hour, and date. I need to write a beast mode that calculates the number of different rows that have the same network, hour, and date, and divide that count by the number of avails (not summed). So for the last two rows, the calculation would be 2 / 12. This needs to be in beast mode since the calculation will change depending on certain filters.

Thank you!

Best Answer

  • DavidChurchman
    Answer βœ“

    The numerator seems like it will be a straight count.

    For the denominator, you want an average of the Avails fixed by your distinct grouping.

    count(Network)/(AVG(Avails) FIXED(By Network,Hour, Date))

    Please πŸ’‘/πŸ’–/πŸ‘/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.

Answers

  • Jones01
    Jones01 Contributor
    edited September 10

    @jrtomici so are you saying your resulting beastmode on that data would calculate the below.

  • DavidChurchman
    Answer βœ“

    The numerator seems like it will be a straight count.

    For the denominator, you want an average of the Avails fixed by your distinct grouping.

    count(Network)/(AVG(Avails) FIXED(By Network,Hour, Date))

    Please πŸ’‘/πŸ’–/πŸ‘/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.

  • @DavidChurchman I think this is the right track, but it's not perfect.

    The second to last row (A, 3, M) should be 0.33 since it's one row with that Network/Hour/Date combo and 3 avails.

  • @jrtomici

    Hard to say what's going on. It looks like you added a few rows to your example data. Could you post a screen grab of the raw example dataset, too?

    Please πŸ’‘/πŸ’–/πŸ‘/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.

  • jrtomici
    jrtomici Member
    edited September 10

    @DavidChurchman sorry, I did add some rows just to test your formula since it wasn't working on my actual dataset.

    I now realize that it's working as intended!! Sorry. I still don't know why it won't work with my dataset but I will look into it.

  • There are two A/3/M rows, so 2/3=.67 is correct, right?

    Please πŸ’‘/πŸ’–/πŸ‘/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.

  • @DavidChurchman yes, that is correct, my apologies. Formula seems to work with the test dataset but not the actual so I will need to do some digging. Thank you!