Calculate the Average Sales per Shop with VEEML - analytics

I've got a dataset with a column containing the id of the shop, another column with the EAN code of the product, and another column containing the quantity sold.
I create a Dataview in VEEML to link that to a calendar with the months and the year.
Can I create a metric on that Dataview to get the average quantity of sold items per shop, per months, years, etc ?

All the filters, dimensions and metrics used by a story could be edited in the pop-up "Datafields".
At the bottom of the left menu, click on the database icon to open the datafields options.
Search the field containing the quantity
Expand that field
Fill the textbox with the right SQL ANSI calculation. Don't forget to add a name at your metric at the end of the calculation using the "as name_of_the_metric"
Check the checkbox Is Metric As
Here, your calculation can be something as :
SUM(Sales_Quantity)/COUNT(DISTINCT ShopId) as Avg_Sales_Per_Shop
In each chart or grid, that calculation will be applied dynamicaly for each level of the dimensions in that chart.

Related

Google Data Studio convert metric to dimension not working

I have imported my GA4 data into Google Data Studio and am trying to see how many giftcards have been sold by their value.
The item revenue metric in GA4 is equal to the giftcard value (i.e. revenue = $200 therefore $200 giftcard was sold).
I want to breakdown sales by giftcard value like so:
Giftcard (revenue)
Count
$200
4
$250
3
$300
6
To do this, I need to set a copy of item revenue as a dimension rather than a metric.
In Google Data Studio, I can create a calculated field with the following formula that should convert the item revenue into text:
CAST(Item Revenue AS TEXT)
The problem I'm having is that while the formula sets the field type as text, it is still regarded by GDS as a metric and can't be used as a dimension.
Even when I try to add text, GDS still recognises the field as a number:
CONCAT(CAST(Item Revenue AS TEXT), " giftcard")
To use a metric as a dimension you can make a combination of data. When defining the graphic element (table, for example) and the respective data source, just create a data combination, but do not combine the data with any other source and just define the combination with the initial data itself. So you will have the same data structure only through a combined structure.
When making a combination of data, data studio recognizes all calculated fields (metrics) as dimensions. Thus, it is possible to make the conversion.

Data Studio Time Series Chart Last 6 Month based on Date Filter EndDate

Can I have a time series chart to display the last 6 months QTY sold? as the report filter is monthly based.
ex. Users can choose 2021/10/01 - 2021/10/31 to view the report and there is a chart to display the last 6 months QTY sold. In this case, the time series chart will display 2021/05/01 to 2021/10/31.
If users can choose 2021/06/01 - 2021/6/30 to view the report and there is a chart to display the last 6 months QTY sold. In this case, the time series chart will display 2021/01/01 to 2021/06/30.
Through my advanced knowledge of the platform, I am not aware of the possibility of obtaining the mentioned result.
It is not possible to use the date filter control element and the respective date range as an input variable to define the period dimension used in the temporal graph.
You will probably have to look for an alternative solution that doesn't match the proposed objective. Using a fixed period of the last 6 months, without the possibility of dynamic variation through the date control element. Or, use two date filter control elements, one for the time graph only. Solutions far from ideal.
The issue was solved, I created another data source for 6 months of sales.

Identify elements that do not appear in the period (Google Data Studio)

I have a table that shows the recurrence of purchasing a product, with the columns: product_id, report_date, quantity.
I need to list in a table the products that are more than 50 days unsold. The opposite I managed to do (list those that were sold in the last 50 days) but the opposite logic has not yet been able to implement.
Does anyone have any tips?
An example of the table:
product_id,date,report_date,quantity
329,2019-01-02 08:19:17,2019-01-02 14:34:12,6
243,2019-01-03 09:19:17,2019-01-03 15:34:12,6
238,2019-02-02 08:19:17,2019-03-02 14:34:12,84
170,2019-04-02 08:19:17,2019-04-02 14:34:12,84
238,2019-04-02 08:19:17,2019-04-02 14:34:12,8
238,2019-04-02 08:19:17,2019-04-02 14:34:12,100
238,2019-08-02 08:19:17,2019-08-02 14:34:12,100
238,2019-10-02 08:19:17,2019-10-02 14:34:12,100
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
There are many steps to do this task. I assume the date column is the one to work with. Your example from table includes duplicated entries. Is it right that at the same time the order is there twice?
So here are the steps:
At first add an calculated field date_past to your dataset:
DATE_DIFF(CURRENT_DATE(),date)
To the dataset add a filter SO_demo with:
include date_past<30
Then blend the data with it self. Use product_id as Join key. Only the 2nd dataset has the SO_demo filter. Add to the dimension of this dataset the calculated field sold_last_30_days with the formula "yes".
In the table/chart to display add a filter on the field include sold_last_30_days is Null.

change bars chart granularity to Days/Month/Week by report user

i have few simple charts where each bar represent day according to date rage control I've added.
i want that the report user will be able to change aggregation
so instead of each bar that represent day,i want each bar that represent month or week
is there anyway i can do that in Google Data Studio ?
Thanks
Assuming you have date as Dimension in the Data tab to the right.
You can 'drill down' by selecting the switch just below.
Add the date dimension again then edit this new dimension and change type
to Date/time and select the granularity such as week or month.
Then in view mode there will be up and down arrows in the top right of the plot which allows you to change view to different drill down options (week/month etc) which you selected in the data tab.

scorecard chart how use date, datastudio

I would like use latest date value from my table in Scorecard,
Any idea how to import this Date value in DataStudio report ?
There is no option like "Max Date", similiar to Max value used in Digit Values.
There is only Count option:
Or advice how to insert date as Label to another ScoreCard chart.
2)
One more question: Is it possible to insert date function in Text field? Probably not right ? If I wanna join my line of text with some Date
Hi Nim thanks for help and what about if I want show last data from last 3 days in 2 item dimension table ? In one item I can just use row filter, but how in 2 item ?
In my case for example most 5 countries by last 3 days, by now I can only show most 5 countries by last day:
...Actually I can setup in the bottom option : date range (last 7days), but I have still too many rows, solution should be somehow limit number of rows per day...somehow
Question 1: How to display the Max Date LIKE a Scorecard?
1.1) Data Tab
- Chart Type: Table
- Dimension: Date
- Sort: Date in descending order
- Rows per page: 1
1.2) Style Tab
- Show Header: Deselect
- Row Numbers: Deselect
- Show Pagination: Deselect
- Table Labels Font Size: As required (e.g. 24px)
1.3) Text Box
- Add a Text Box stating Max Date if required
- Precision Movement: Use Shift + Movement keys to finely place the components exactly where required.
Google Data Studio Report and GIF to expand on the above:
Question 1 (Original Post - Currently doesn't work as expected): How to display the Max Date on a Scorecard?
At the Metric field of the Scorecard, create a Chart-level Calculated Field that explicitly aggregates the Date field by MAX:
MAX(Date)
Google Data Studio Report and a GIF to demonstrate:
Question 2: How to display the latest Metric?
2.1) Data Tab
- Chart Type: Table
- Dimension: Date
- Metric: As required (e.g. Sessions)
- Sort: Date in descending order
- Rows per page: 1
2.2) Style Tab
- Show Header: Deselect
- Row Numbers: Deselect
- Show Pagination: Deselect
- Table Labels Font Size: As required (e.g. 24px)
2.3) Overlay
- Add a shape or text box over the Date field part of the Table to ensure that it's not visible and set the colour of the shape to a solid colour that blends in with the background (such as White for a White coloured background).
- Order: Ensure that the shape or text box is placed in front of the Table.
- Precision Movement: Use Shift + Movement keys to finely place the components exactly where required.
Google Data Studio Report and GIF to elaborate:

Resources