On a particular type of page, I have an event that fires every time someone enrolls in a product. The event is:
Category: Enroll
Action: < Name of Product >
Label: enroll
I am able to create a report that lists the number of times the event was fired on Pages by using the metric of total events and filtering by the label enroll This gives the page that it was fired on and the count of the event.
I'm now trying to do conversion rate. So, I'd want to get
(Total Events on the page (filtered by Event Label="enroll")) / Unique Pageviews
I can't figure out how to do the total events filtered in Data Studio using a calculated metric. Is there a good way to do this?
Try using REGEXP_MATCH in the sum of a case statement to achieve what you need.
Creating a metrics as follows and then do the division by unique pageviews as a second metric.
SUM(case when REGEXP_MATCH(Event Label, "enroll") then 1 else 0 end)
Related
I asked a similar question before but I am still struggling and was not able to do what I was required to do and am coming back to this community for help.
I am trying to increase the price of the products on a quote in salesforce CPQ/Billing based on a field and to do this automatically.
The Setup
In Salesforce CPQ, If you go to account -> Contract -> Sales Service: There is a field called Price Increase %(PROD_Price_Increase__c)
A contract can have multiple quotes
What I want to do
When a quote has reached the final step a contract is created. In the contract I have the option to click a button called Amend. Which allows me to take the products in the existing quotes and amend it.
I want to create a batch job that does the following:
The Contract has these fields: Start Date (PROD_Start_Date__c), Price increase Date (PROD_Increase_Date__c), End Date (PROD_End_Date__c).
-- If the Price Increase Date is 12 months after the start date, these are the contracts that will need to be updated
-- For example, If the start date is 15 Feb 2023, Price increase is 1 Jan 2024, end date is 15 Feb 2025. Since the increase date is not 12 months, these contract should be ignored.
Main Task
When products who have a price increase 12 months after the start date, the contract should be able to 'amend' and update the quantity of the products and clone the products.
In the contract, the action buttons on top have "Amend". once clicked, it shows all the subscriptions products, you click next then it comes into the edit quote page.
Once here it shows all the products that were part of the contract and its quote. The net price filed for the original products will be '0'. These products will need to be cloned and the quantity for these to be applied to the cloned products. Once the quantity has been copied over, the original products quantity should change to 0.
After these products have a quantity of 0, the clone products should have the price increase. The value I mentioned from earlier Price Increase % (ROD_Price_Increase__c) value should be added to the Discount filed in the quote but as a minus value since we are doing an increase of price.
Once this has been done, we can submit/order the quote. This creates a new quote. Once the new quote has been created, I want to be able to update a filed in the quote - a checkbox that says order. I want to be able to check the value on it.
This all should be done automatically like though Apex and Flows.
Sorry for this long text and request. I apologise and know some of the information not be out of box or confusing. Its one of these challenges I have been facing with trying to automate this.
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.
I'm trying to figure out how to connect checkbox with chart.
What I need to do is the following:
I have a chart showing two lines (two sets of data, lets name them A and B).
After checking a checkbox "compare A with previous period" or "compare B with previous period" those data disappear and instead of them a suitable comparison is shown.
I know that it is possible to make checkbox dependent chart like here:
https://datastudio.google.com/reporting/23a0d8ac-96c0-42cc-a991-5a21bc7c9962/page/VvbsB?s=rw4uzVA5G9Y
but I don't know how to do it.
I tried looking for the solution on the Internet, but nothing found.
Thank you for your help in advance.
A step by step introduction how to blend data and add checkboxes to show/hide graphs. Also how to do a calculation across datafields in different datasets, which were blended.
Add to the dataset a checkbox with the name compare_a_with_previous_period the field 3days average on/off with
case when compare_a_with_previous_period then 3days average else null end
Depending on the checkbox data is shown in that field or not (null). For blending/joining the data over different dates, a timeshift has to be done. Therefore, create a field date_old with
datetime_add(Date,interval 30 day)
Create an parameter show_differences with range 0 to 1 and add a field show_differences with
case when show_differences = 0 then 0 else 1 end
This will later be used to switch on/off the graph for the difference calculation.
Blend the data with itself using date and date_old as join and range. And rename the 3 day average to 3 days_old
Add the chart and click on the "add metric"
and enter
case when show_differences > 0 then 3days average - 3days_old else null end
to do a calculation between the bend datasets. Under Style set the missing data to "Line Breaks".
I am trying to change the cost price of products in Odoov13 in postgresql database, can anyone please support me with an example or guide? The question is simple, there is a selling price and a cost price (standard price) on the products, I just try to change the cost price, not the selling price, but I don't know how to get to the table or column, the Only reference I have is that the value can be stored in property field, but I don't know how to access it.
SELECT * FROM ir_property WHERE name = 'standard_price';
Fini
The field standard_price is computed field without store=True So it can store the data into postgres database.
If you want to update the field value, You can make the server-action following step:
Goto Settings->Server Actions
Model : Product Template
Action To Do: Update the Record
Data to Write:
Field : Cost (product.template)
Evaluation Type: Value
Value: Add your value example, 112
make the Create Contextual Action
Goto Product template and refresh the page on the action you can find the created server action and execute.
I am creating a jsp page where a single news item is shown, just like the single question on this StackOverflow page. I need to store the view count in a database.
I can simply increment the view count in the database this way:
`UPDATE table SET views=views+1 WHERE newsId=4458;`
But what if a single user hits that page again and again and again, say 50 times... In this case, my view count will not represent unique visitors to the site. How can I avoid this?
I want something like StackOverflow's view count system.
well one solution could be you make a new table (lets say its called views) with the following columns 'viewid' 'newsid' 'ipaddress' (obviously newsid is the foreign key)
every time someone visits ur website u check if his ip is already in that table for that news item.
Select count(*) AS count FROM views WHERE newsid=1234 AND ipaddress=123.456.125
if count equals 0 you insert like this
INSERT INTO views('newsid', 'ipaddress') VALUES(1234, 123.146.125)
Now when you want to fetch the viewcount:
Select count(*) AS count FROM views WHERE newsid=1234
you can enhance this by adding another column called 'count' and 'lastviewed' (type datetime) to the table views.
Lets say you allow every ip to be counted another time if the day doesnt match.
This way you will get a pretty accurate viewcount :)
to fetch the new viewcount you can simply use SUM
Select SUM(count) AS count WHERE newsid=1234
Good luck :)
You may want to reference spencer7593's answer here, where he basically suggests having both (1) a view count column, for quickly generating your webpages and (2) a separate views table, which records the user id and timestamp pertaining to each view, for the sake of analytics.
I would suggest that this views table could also be used to query if a viewing has occurred for a particular user with a particular piece of content in the last day (or week) when determining if the view count column should be incremented. By checking if a view of a certain item has occurred only in the last day (or week), the DB queries should be substantially less expensive while still protecting the integrity of your view count.
i say use a counter in Javscript . Increment the variable on body onclick. eg:
<script language=”javascript”>
function pageCounter()
{
var counter = 0;
counter = counter++;
}
</script>
<body onclick = “pageCounter()”>
and you can update the value with onclose ..