From Google Analytics data I want to show the number of pageviews for the year to date and show the percentage of change over the same period last year. So, for the current year I want to show total number of pageviews 1/1/2016-[current date] and the percentage change from the same period in 2015, 1/1/2015-[current date].
I've used three measures to try and calculate this:
PageviewsYTD = TOTALYTD(SUM(Fact[Pageviews]),DimDate[Date],All('DimDate'),"12/31")
Pageviews_PreYear = CALCULATE( SUM( Fact[Pageviews] ), PREVIOUSYEAR('DimDate'[Date]))
Pageviews_YoY%Change = DIVIDE([PageviewsYTD] -[Pageviews_PreYear],[Pageviews_PreYear])
I have also used a slicer on the page for years.
The measures work when there are whole years of data e.g. 2015-2014 or 2014-2013, but when the slicer is on the current year the percentage of change is not accurate because its comparing YTD 2016 to all of 2015.
Questions:
What measures are needed to get an accurate YTD 2016 compared to the same YTD period of the previous year?
Can I still use a slicer so the report page can include data for 2013-2016?
Thanks in advance,
Jeff