Group by period - group-by

I am working on Odoo 8 and I have a model that has two date fields (check_in and check_out). I need to perform a group by month filter, but i want records that have different months for their check_in and check_out for example (11/04/2022 - 12/05/2022) to appear on each month when doing the group by filter

In your group_by filter you can use :date_type in order to specific how to group by date.
For example:
<field name="context">{'group_by':'check_in:month'}</field>

Related

How to selectively filter based on a dimension?

Link to tableau graph
I want to selectively filter the above graph based on the year. For example, when I deselect December, I want only the 2018 values to be excluded while keeping the December values for the other years.
Tableau version: 2018.3.0
You can create a calculated field called something like "year-month of order date" that contains logic such as YEAR(Order Date) * 100 + MONTH(Order Date). Drag that field to the filter box and include it on the dashboard. Then the user can exclude any combination of year and month combination.

Calculated Field to Count While Between Dates

I am creating a Tableau visualization for floor stock in our plant. We have a column for incoming date, quantity, and outgoing date. I am trying to create a visualization that sums the quantity but only while between the 2 columns.
So for example, if we have 9 parts in stock that arrived on 9/1 and is scheduled to ship out on 9/14, I would like this visualization to include these 9 parts in the sum only while it is in our stock between those 2 dates. Here is an example of some of the data I am working with.
4/20/2018 006 5/30/2018
4/20/2018 017 5/30/2018
4/20/2018 008 5/30/2018
6/29/2018 161 9/7/2018
Create a new calculation:
if [ArrivalDate]>="2018-09-01" and [ArrivalDate]<"2018-09-15"
and [Shipdate]<'2018-09-15"
then [MEASUREofStock] else 0 end
Here is a solution using UNIONs written before Tableau added support for Unions (so it required custom SQL)
Volume of an Incident Queue at a Point in Time
For several years now, Tableau has supported Union directly, so now it is possible to get the same effect without writing custom SQL, but the concept is the same.
The main thing to understand is that you need a data row per event (per arrival or per departure) and a single date column, not two. That will let you calculate the net change in quantity per day, and you can then use a running total if you want to see the absolute quantity at the close of each day
There is no simple way to display the total quantity between the two dates without changing the input table structure. If you want to show all dates and the "eligible" quantity in each day, you should
Create a calendar table that has all dates start from 1990-01-01 to 2029-12-31. (You can limit the dates to be displayed in dashboard later by applying date filter, but here you want to be safe and include all dates that may exist in your stock table) Here is how to create the date table quickly.
Left join the date table to stock table and calculate the eligible quantity in each day.
SELECT
a.date,
SUM(CASE WHEN b.quantity IS NULL THEN 0 ELSE b.quantity END) AS quantity
FROM date a
LEFT JOIN
stock b on a.date BETWEEN b.Incoming_Date AND b.Outgoing_Date
GROUP BY a.date
Import the output table to Tableau, and simply add dates and quantity to the chart.

Group by weeks in Mongodb where dates are fixed (1-7, 8-14, 15-21, 22-28, 29-31)

I am looking for a way to group my data which has a column with datetime in it.
I want to group it such that, the business requirement is to have the records by a fixed week definition of (1-7, 8-14, 15-21, 22-28, 29-31).
While MongoDB $week would group by calendar weeks.
Any idea how to go about this custom grouping?

PostgreSQL 8.2 extract week number from a a date field

This might be a simple one but I haven't got a solution yet. I have a create_date field which is a date type, and a revenue number. I want to see weekly break down of revenue.
I can get the numbers easily in tableau because of built in functionality but doing it in PostgreSQL is where I need some help.
If you want the revenue by week, you'll need to group and aggregate:
select extract (week from create_date) as week, sum(revenue) from table group by week

how to select data on single click in tableau

I am presently working on tableau worksheets, the data is based on sales and order, it contains months, year, KPI, data value as some of its corresponding fields , what I am trying to do is when any month is selected it should return all the measure and sum of data value of that month as well as all the months before that particular month.