Best Of
Re: I want to understand average sales within 1 year of client sign up
Wow, @nmizzell, that was everything I was looking for and more. Incredible stuff and I truly appreciate the walkthough you provided. 🙌. Many, many thanks!
Re: I want to understand average sales within 1 year of client sign up
- 1. Define a variable for the number of days after client start date that you want to include. This variable can be added in the dashboard as a control and can be manipulated. I will refer to this variable as `Number of Days To Include`
- 2. Create a beastmode to calculate total client spend within the specified days:
sum(case when `date` >= `Client Start Date` and `date` ⇐ date_add(`Client Start Date`, interval `Number of Days to Include` day) then `Total` end)
3. If you want to find the average client spend, divide this value by the distinct number of clients in the time interval.
(sum(case when `date` >= `Client Start Date` and `date` ⇐ date_add(`Client Start Date`, interval `Number of Days to Include` day) then `Total` end))
/
(count(distinct case when `date` >= `Client Start Date` and `date` ⇐ date_add(`Client Start Date`, interval `Number of Days to Include` day) then `ClientID` end))
4. To split the output by year, make sure that the "graph by" setting on your visual is by year.
nmizzell
Re: MoM Variance in Pivot
@Dverdon As @MichelleH says, pivot tables won't allow you to calculate in between columns and a Mega Table with a Beast Mode might be your best bet, as you won't need to do much to transform your data prior, although you'll lose the drill down capabilities you have in a Pivot Table (in case that matters to your case).
Another option would be to use an ETL to have the displaced value listed as well (Using DATE_ADD(`Date`,INTERVAL 1 MONTH)), there would be basically 2 ways to achieve this, either with APPEND or JOIN.
The Append route is simpler although it will require you to store more rows, you'll need to identify the values with an additional column with either a value of 'Current' or 'Displaced' and then in your beast modes you'll use:
Current value
CASE WHEN `Identifier` = 'Current' THEN `Value` END
Variance
CASE WHEN `Identifier` = 'Current' THEN `Value` WHEN `Identifier` = 'Displaced' THEN -1*`Value` END
And you'll add these to your Pivot Table as values, selecting SUM as the aggregation type (if you want % of change you'll need to do the aggregation and division as part of your beast mode).
Keep in mind that when adding 1 month, any date that would fall outside the next month, becomes the last of the month instead (Jan 29, Jan 30, Jan 31 both become Feb 28/29 for example).
Re: How to calculate last year's average to use in this year's projections
You'll need to join the single value to every row in the dataset. To do this, create a constant value, you could call it 'Join column 1' and it could be the number 1 or any other value, and include it in your group by. Then split out a new flow from WC WCB Activities and create a constant value column called something like 'Join column 2' that matches the value you created in 'Join column 1' and then join on Join Column 1 = Join column 2. Now you'll have that average value on every row of your data to compare with. If you need different values on different rows by year or month or whatever, then you would split out the dataflow as mentioned and join on year = year or year + month = year + month, etc…
Re: Issues Joining Transaction Details to Primary Dataset
Thanks for solving, had some duplicate names and unnecessary columns and John the dashboard dude helped me fix them. Thanks again!



