Solved

Top 10 results per day

  • 22 August 2021
  • 2 replies
  • 23 views

I have a measure called `timeSpent` which is time a user spent in seconds on a page.

I have attribute called domain which is the site the user visited, and I have the date.

I want to create a stacked bar chart showing the sum of timeSpent for each domain on each day. As there are too many domains I try to filter the top 10. However, that returns the top 10 overall, and I would like to show the top 10 sites per each of the days.

I went over the maql courses, and tried many different things, and I am struggling. I think that row_number could somehow help here, or at least that’s how I would have solved it in sql, but I am not sure how to use it here.

 

 

icon

Best answer by Joseph Heun 23 August 2021, 09:21

View original

2 replies

Userlevel 2

This really depends on your model and connection points, and also how that initial metric ‘timeSpent’ was built. At first thought you could try something like the following:

 

Select timeSpent Where top (10) in (Select timeSpent) By (connectionpoint) within (domain, ALL OTHER)

 

However, you may need to incorporate a Disconnected Date Dimension into the LDM in order to make this work in your use case. If you are still facing issues, you can reach out directly to our support to open a ticket, where we can directly look into your reporting. 

Hi Joseph, thanks for your answer. I am new to GoodData, I will read about the DDD and see if I can make progress.

Will reach out again if I am unsuccessful. 

Reply