Second Life of a Hungarian SharePoint Geek

February 5, 2014

Creating a Report of Weekly Aggregation of Visits by Title

Filed under: Analytics, SP 2010 — Tags: , — Peter Holpar @ 00:56

The other day we had to create a summary of visits to a specific SharePoint list to see the trends as new items have been published. The hits must be aggregated by the calendar week. To achieve that goal we run the following query on the Web Analytics Reporting database, then exported the results into Excel and created a Pivot table for further processing by business users.

SELECT
assets.Title,
DATEPART(YEAR, CONVERT(DATETIME, CONVERT(CHAR(8), clicks.DateId))) AS Year,
DATEPART(ISOWK, CONVERT(DATETIME, CONVERT(CHAR(8), clicks.DateId))) AS WeekOfYear,
SUM(clicks.Frequency) AS ClickCount
FROM [Web Analytics Reporting].[dbo].[WAClickAggregationByDate] clicks
inner join [Web Analytics Reporting].[dbo].[WAAssetMetadata] assets
on clicks.ClickedAssetIdHash = assets.AssetIdHash
WHERE assets.AssetId like ‘http://yoursite/Lists/listname/dispform%’
GROUP BY assets.Title, DATEPART(YEAR, CONVERT(DATETIME, CONVERT(CHAR(8), clicks.DateId))), DATEPART(ISOWK, CONVERT(DATETIME, CONVERT(CHAR(8), clicks.DateId)))
ORDER BY Year DESC, WeekOfYear DESC, ClickCount DESC

Note: In this report we assumed that the title of the item is unique!

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Create a free website or blog at WordPress.com.