Forum Discussion
Time Intelligence: Calculating averages across various time-periods
Hey there, thank you for your help the other day. I wanted to throw a similar question your way...
What is the best practice for using SamePeriodLastYear ; PriorYear ; and/or DateAdd? When using time intelligence, should one refrain from using Time-Slicers? My issue is that I need to provide a slicer for years (for my end users), but also want to show metrics for the same period in the prior year.
I am trying to do a simple calculation: YTD Count of Negative Reviews (2016) & Same Period Last Year Count of Negative Reviews (same period in 2015)
YTD Count of Negative Reviews = TOTALYTD(COUNTA(Dim_Service[MOVES_ID]), Dim_Date_Service[DateKey], Dim_Service[Positive/Negative] = "N") -----> this gives me the correct output.
Same Period Last Year Count: = CALCULATE(COUNTA(Dim_Service[MOVES_ID]), Dim_Service[ISSUE] = "N", DATEADD(Dim_Date_Service[DateKey], -1, YEAR)) -----> output is BLANK
Report Context: I am currently using a Year Slicer on the canvas. When I select "2016", my YTD count appears. Without the yera selection, it is blank. The Prior Year measure is always blank.
greggyb I know that I could hardcode this measure to say something like:
2016 Negative Count = CALCULATE(COUNTA('Dim_Service'[MOVES_ID]), 'Dim_Service'[Positive/Negative] = "N", Dim_Date_Service[Year Entered] = 2016)
but after your advice last week, and my negative experiences with hardcoding time-intel function, I am trying to avoid when possible.
Thank you again