Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis , P() and E()

Dear community,


I have a trouble using set analysis P() and E()

I have one access log table as below:

UserID     URL     ACCESS_DATE     Content_category
id1/url/request1 2013/11/2  A
id1/url/resuest2  2013/11/2B
id2     /url/request3 2013/11/2 A
id3     /url/request42013/11/3C

I want to count UserID who accessed Content_category A and who didn't access Content_category B.

I tried in chart:

dimension: ACCESS_DATE

expression:

count({$ <UserID = P({$<Content_category = {'A'} UserID) - P({$<Content_category = {'B'} UserID)>} )

              >}

  DISTINCT UserID )

But it doesn't work.

when I select on ACCESS_DATE on list box of ACCESS_DATE, it works well.

But I select over 2 ACCESS_DATE, UserID count is not correct.


What happend in this script ?

4 Replies
swuehl
MVP
MVP

Set analysis is calculated once per chart, not per dimension value. It won't consider your current dimension value (ACCESS_DATE), so it will select the UserID's that ever accessed A and never accessed B (ever / never with regard to your selections in ACCESS_DATE field).

Does this explain what you see?

Not applicable
Author

Thanks. I understand.

But, then do you know how to calculate what I want?

Not applicable
Author

You could try an If() statement with an aggregation over ACCESS_DATE and UserID:

Count(DISTINCT Aggr(If(Content_category='A' and Content_category <> 'B',UserID),UserID,ACCESS_DATE))

jerrysvensson
Partner - Specialist II
Partner - Specialist II

Hi

Will this work for you?

count({<UserID = E({<Content_category = {'B'}>} UserID), Content_category = {'A'}>} UserID)