select one month data from particular source type - sql

We got hdfs data in - source_type/yyyymmdd/hr/xxx.parquet
How do we search in hue/impala if we need one month of data (say Aug 2022) from a particular source_type?
Thanks!

Related

Calculate the number of active vendor in the last 3 months in Bigquery

I am a newcomer to SQL, I want to calculate the number of active vendors in the last 3 months (A vendor is considered to be active if there is at least one transaction with that vendor within a
certain timeframe)
The data getting from access the https://console.cloud.google.com/marketplace/product/iowa-department-of-commerce/iowa-liquor-sales?filter=category:analytics&filter=price:free&filter=solution-type:dataset&project=fiery-plate-322918&folder=&organizationId= dataset.
Thank you in advance <3
The table was updated on Jun 4, 2019. So there are no current data available of the last months.
vendor_number
FROM `bigquery-public-data.iowa_liquor_sales.sales`
where date>date_sub (current_date(),interval 3 month)
GROUP BY 1
returns no data.

map dates in ship week sql

I'm trying to map ship_date to the correct ship_wk (our ship weeks go from Sunday to Saturday) and I'm not sure how to do it.
The table the ship week field pulls from is currently mapping them incorrectly. For example, ship_wk = 42 should show dates 10/14 - 10/20, but is showing 10/21 - 10/27.
I need to create a different ship week field within my query that uses the correct mapping. I've never worked with dates in this capacity. Any suggestions?

OBIEE Moving Average Drill Down

I have created a graph to show 6 months moving average column for last 13 months
Now users want to drill on these 6MMAs for last 6 months data contributed to that moving average.
Say , for Mar 2016 the contributing months are 10/2015, 11/2015, 12/2015, 01/2016, 02/2016 and 03/2016.
So when user clicks on Mar 2016 data point they should see all contributing projects for that month i.e. 10/2015, 11/2015, 12/2015, 01/2016, 02/2016 and 03/2016.
For Feb 2016 the contributing months are 09/2015, 10/2015, 11/2015, 12/2015, 01/2016 and 02/2016.
So when user clicks on Feb 2016 data point they should see all contributing projects for that month i.e. 09/2015, 10/2015, 11/2015, 12/2015, 01/2016 and 02/2016.
And so on..
How can I achieve this?
Create one more analysis which will show data for all months/year.
And create a drill down from your master report which will be navigated to the detail report .
Also on what column basis you want to display your detail report ,give "column as prompted " there.It will be like "Master-Detail" analysis.
So when you will click on master report,that value will be passed as a parameter to detail report through "is prompted".And required value will be displayed.
PFB the link for detail explanation.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/bi1113/actionframework/actionframework.htm
Hope it is helpful.
you can try a work around.write a formula in your month column in your detail report. --Extract year from the presentation variable and month should be latest value of the month column and (month-5).Try with this. Try to create the detail report which will basically show the last 5 months data.and pass the variable accordingly. – mona16 12 mins ago
try some thing like this in your date column in detail report. use filter on you date column Time.Date <= cast(current_date as date) and Time.Date >= TIMESTAMPADD(SQL_TSI_MONTH, -3, TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))

extracting common data of current months and last two monnth sql

I have a table with more than 20000 rows, In one of column i have month from jan 2014 to Dec 2014, and in another column i have a loan number. Most of the loan Numbers are reapeting every months,now i need to get only the loan Number which are apperead in all three monthy consecutively. For eg if i am getting data for current months i also wanted get data which are common in two months before the current months. The database that i m using is Access DB. Any adivice will be more than a help, Thanks in Advance.
SELECT Loans.LoanID, Sum(IIf([period]=[month],1,0)) AS CM, Sum(IIf([period]=[month]-1,1,0)) AS [m-1], Sum(IIf([period]=[month]-2,1,0)) AS [m-2]
FROM Loans
GROUP BY Loans.LoanID
HAVING (((Sum(IIf([period]=[month],1,0)))>1) AND ((Sum(IIf([period]=[month]-1,1,0)))>1) AND ((Sum(IIf([period]=[month]-2,1,0)))>1));
I used month as an integer, and didn't make any adjustment for months 1 and 2 to loop back and look at prior year - you should be able to modify this based on the actual format you are using for the month.

how to summarize sql result, week and month wise in single query

I want to summarize sql query result week wise and month wise at the same time in a grid view. Is this even possible or I am just dreaming?
Requirement:
Show last one month data and next two month's data week wise in the grid.
Example-
If the current month is September then I want to show data from 1st August to 31st October categorized in weeks.
Show the data after the next month of current month in month wise view in the same grid.
Example-
data for month November and December will be shown categorized in month not in weeks.
grid or result should look something like below -
Please suggest something to achieve this
If you want a maintainable solution, use two independent queries, one for weekly aggregation other for monthly. Depending on the input run corresponding query.
I think you must work with group by or group by ... cube
SELECT x , y from <tabel> GROUP BY date_feld( to_char( 'MM' ))
but i don't now your DBMS so i can't give you a exact example for the date handling.