Get startedGet started for free

Analyzing five star reviews

1. Analyzing five star reviews

In this scenario, we are an analyst working with the marketing department. Our marketing team wants to understand public sentiment around our specific products that we have on some online marketplaces. Looking at the data, we can see that we have a variety of reviews and scores from January 1, 2021 through mid June in 2022. We have been tasked with a couple problems to tackle: 1) how many five-star reviews have we received so far this year, and 2) how does that compare to the same point last year? To start off, let’s visualize the reviews that we have for each day. First, I will select a stacked column chart, and drag the Date field into the x-axis. Then, I will drag the review_id field into our y-axis, and separate the values by the review score in the legend. We can see that we have a good spread of different review scores over time. Just by looking at the chart, it would be difficult to accurately compare this years performance to last year. Luckily, with DAX, we have a good strategy and solution. We will start by addressing our first problem, which is understanding how many five-star reviews we have this year. We will create a measure called current_year_five_stars and can leverage the TOTALYTD function. The TOTALYTD function takes any expression and will calculate it specifically for all the data we have in the latest year. In our case, we want to count the number of reviews, and we need to pass our dates as the second argument. Then, we can pass a filter to our calculation, which for us means filtering out only the reviews where we have five stars. current_year_five_stars = TOTALYTD(COUNT(review_data[review_id]), review_data[date], review_data[review_score] = 5) When we visualize the result in a card, we can see that we have 54 five star reviews. Now, lets see how this compares to the same period from the period last year to see how we are doing. With DAX, we have the SAMEPERIODLASTYEAR function, which can apply an already calculated measure to a previous period. To start, we need the CALCULATE function, and then we want to calculate the same measure as before: current_year_five_stars. The, we will pass the SAMEPERIODLASTYEAR function as our filter, where we can dynamically calculate the relevant number of five star reviews. last_year_five_stars = CALCULATE([current_year_five_stars], SAMEPERIODLASTYEAR(review_data[date])) Visualizing this measure, we see that at this point last year we have 69 five star reviews, which is significantly more than we have this year. Using this information, we can talk to our marketing and product teams to see what we can fix. This was an example of how to combine different time series calculations into a single analysis. Now, lets go ahead and practice these kinds of applications on our superstore dataset.

2. Let's practice!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.