ElasticSearch and Kibana: compare value with aggregated value - kibana

I'm wondering how to accomplish this requirement.
I have to compare value data with the average over the selected period or over another period.
I've collected millions of records in an index. These records contains the sellout amount day by day for different vendors, products, sectors and product families.
What I'd like to do is to analyse any single value with the average of the selected period of the average of the same periodo of a previous year. I'd like to use Kibana to show data to users.
How can I accomplish it?
Thanks

Related

Tracking total meeting attendance across participant start and end times

I have attendance data for a virtual meeting. This includes the employee name, their direct manager, and their respective join/leave timestamps. Some employees coming and going multiple times (see rows 5 and 6)
I'd like to create a visualization showing attendance (as a percentage of total attendees) over the course of the meeting session, beginning to end.
To do this, I figured I'd create a table with the first column being a sequence of times starting from the min(join_time) and ending with the max(leave_time) broken down in 30 second intervals. Then add summary columns that count the total instances where that time falls in an employee's join/leave time like this...
I'm working in R within the tidyverse so if there's a dplyr, lubridate solution that'd be ideal.

How to code a revenue forecasting model in R for every certain value?

I have a data table that has a column for the fiscal quarter, a column for the net revenue made for row X's sale, and a column for the type of sale it was.
I want to use a forecasting method in R (was planning to use ARIMA, but am open to options) to predict future fiscal quarter net revenue per type of sale. For example, if the two types of sale are service and good, I want to create a model to predict future revenue for service and a model for good's future net revenue.
How would I approach this code and are there any websites you'd recommend I reference. Thank you in advance!
The websites I have found so far reference if every timestamp (i.e. every fiscal quarter) has only one row. But, my data table shows how i.e. quarter 1 can have 10 different sales and 5 can be labelled service and 5 are good.

Tableau graph average and sum

I have transactional data for a sales team showing the transaction amount per transaction, the sales person for that transaction, his team and his salary. Every row denotes a unique transaction (please refer image). I need to make a team-level graph which shows the correlation between the salary they are paid and the revenue they generate for the company i.e. a simple stacked bar chart with salesTeam name on X axis and amounts on the y axis with every bar representing the total salary and total revenue(Amount) for a team.
In the example I've highlighted team 'Central', for which the salary paid is 25k (10k for salesperson A + 15k for salesperson B) and the revenue they make for the company is 430k. Please note that the salaries for some salespersons may be missing (eg. for E). The issue I'm facing is that sum(Salary) adds up the salaries for every row, so for salesperson A it becomes 20k instead of 10k. I tried avg(Salary) but that doesn't work as Tableau calculates the average for the entire column instead of average per salesperson. How can I solve this issue?
Thanks
Here you have a level of detail problem. Basically, Tableau will calculate a formula at the level of detail of the visualisation, so if salesperson is not in your view it will roll up the equation to calculate at the highest level. This is great when you want a dynamic calculation but that doesn't sound like what you are trying to achieve.
Your best option would be to aggregate the data into Tableau so you only have 1 line per sales person with a total of their revenue for all transactions. This would avoid the complexity of the calculated field (and make Tableau perform better).
However, if this is not possible the good news is the answer is a Level of Detail expression (i recommend doing some reading on this if you havent come across before). Basically, you tell Tableau at what level you want the calculation at.
If I understand you want to calculate the ratio of transaction amount and salary paid for each team.
So create a calculated field as follows:
{ FIXED [Team]
: sum(([Amount]))/
(sum({ FIXED [Sales person]:
AVG([Salary])}))
}
What this does is calculates for each team the ratio between the amount and the salary. The use of the second fixed equation that is nested within it (Salesperson) ensures that the salary is not summed for the number of transactions of a salesperson.
Using this I got a result of 17.2 for Central. Is this what you would expect? Do you need a way to account for salaries that are not known?

Wrong data over users google analytics

I am building one BI over analytics data. Users Tracking give different numbers over different dimensions (Hour, Day, Week, Month) in the same period of dates.
How do I explain this? Is this wrong?
Users is not a metric that you can sum for different time ranges as one user can have sessions in multiple time ranges and so simply summing the number of users each day won't equal the total number of users in a week etc.

dimensional data modelling design - Data warehouse

I am having
dimension tables
item (item_id,name,category)
Store(store_id,location,region,city)
Date(date_id,day,month,quarter)
customer(customer_id,name,address,member_card)
fact tables
Sales(item_id,store_id,date_id,customer_id,unit_sold,cost)
My question is if I want to find average sales of a location for a month Should I add average_sales column in fact table and if i want to find sales done using the membership card should I add corresponding field in fact table?
My understanding so far is only countable measures should be in fact table so I guess membership_card should not come in fact table.
Please let me know if I am wrong.
No, you should not add an average sales column to your fact table, it is a calculated value, and is not at the same "grain" as the fact table.
Your sales fact table should be as granular as possible, so it should really be sales_order_line_items, one row per sales order line item.
You want to calculate the average sales of a given store for a given month...?
First, by "sales" do you mean "revenue" (total dollars in) or "quantity sold"?
Average daily revenue?
Average monthly revenue, by month?
If you have the store id, date, quantity sold (per line item) and unit price, then it's pretty easy to figure out.
You Should not add aggregate columns In the same fact table. The measures in the fact table should be at the same grain. So if you want aggregate metrics, build a separate fact table at the required grain.
So, I might have a fact aggregate table named F_LOC_MON_AGG which has the measures aggregated at location and month level.
If you do not have aggregate tables, modern business intelligence tools such as OBIEE can do the aggregation at run time.
Vijay

Resources