Skip to main content

Hi,

 

I have the following CSV data and my requirement is that I'm supposed to generate %age of AppKilled against Started by a specific user (that is userid). It is easy to calculate %age of AppKilled by taking into account all rows for each user  but I need some guidance or advice as to how I can do that by, say, taking into account top 3 rows only of each user ? Please look at the dataset below.

 

For instance I have the following three measures at the moment that take into account all rows:

 

NumberOfTimesAppKilled

count (

if ([AppKilled] = TRUE) then

[userid]

End

)

 

NumberOfTimesStarted

count (

if ([Started] = 'yes') then

[userid]

END

)

 

PercentageOfAppKilled

[NumberOfTimesAppKilled] / [NumberOfTimesStarted]

 

The following table contains shows the dataset that I'm using.

 

userid,AppKilled,Started

345,TRUE,yes

345,TRUE,yes

345,FALSE,yes

345,FALSE,yes

345,TRUE,yes

345,TRUE,yes

345,FALSE,yes

345,TRUE,yes

345,TRUE,yes

345,TRUE,yes

123,FALSE,yes

123,FALSE,yes

123,TRUE,yes

123,TRUE,yes

123,FALSE,yes

787,TRUE,yes

787,FALSE,no

787,FALSE,yes

 

Any suggestion / guidance /advice will really be appreciated.

 

Thanks.

13 respostas
  1. 8 de set. de 2019, 12:50

    Hey Oliver Clarke

     

    I can't just replace my data source since as I said earlier I have calculated fields in the dataset that are computed using some columns that are part of the main datasource. The dataset that I have provided here and you have used as well is actually contains sample columns that are relevant for my use case so I can't just use that. But I really appreciated your reply.

     

    By the way I have figured out what the real issue was and that is NOT using the userid and restarting the index at every new userid. Because if you think about it if we don't restart the index, then at some point it will go cross our number of rows to select from which will start causing issues in computation. As you may recall:

     

    INDEX()<=[Top rows per User]

     

    So I made userid part of our table calculation and restarted it at every new userid and that solved it. And this was the idea in the first place .. right? Since we wanted to take the top rows for every userid we have. The issue became obvious right away with my data source because I have a big data source and there are many rows against user id and in the data sample provided here in this thread doesn't really reflect the size of the datasource which obviously I couldn't provide here.

     

    Hopefully the issue and its resolution make sense to you.

     

    By the way I really want to thank you for all your help and all of your replies were really instrumental in implementing my requirement and get to the bottom of the issue faced during the implementation.

     

    By the way I would like to send a gift as a token of my appreciation to you, how can I do that? Do let me know, I would think the postal address should suffice.

     

    Regards.

0/9000