Categories
- All Categories
- 15 Oracle Analytics Sharing Center
- 15 Oracle Analytics Lounge
- 214 Oracle Analytics News
- 43 Oracle Analytics Videos
- 15.7K Oracle Analytics Forums
- 6.1K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 78 Oracle Analytics Trainings
- 15 Oracle Analytics Data Visualizations Challenge
- Find Partners
- For Partners
Little help with my report

Hello! It will be nice to someone help me with my report or give same ideas. I want get in the results 'Product name' and how many days his quantity=0. For example I have this table
So I want to see:
Period is not necessary.
PS. I dont want you do this for me, if you give me some tip it will be Okey.
Answers
-
logical column with a 1 or 0 based on the criteria of quantity by day ... then sum up the new logical column over time ...
0 -
Thanks Thomas I do like you say.
Did you know how I can do this with Period. I must write question like this "show me period, product, quantity, and how many when day -1 quantity of produt was 1 OR NULL".
For 0/1 column i do this formula:
SUM((CASE WHEN "Dane"."Quantity"=0 THEN 1 WHEN "Dane"."Quantity">0 THEN 0 WHEN "Dane"".Quantity)" IS NULL THEN 1 ELSE NULL END) BY "Product"."Product (name)"
Result:
0 -
mistake:
Did you know how I can do this with Period. I must write question like this "show me period, product, with quantity=0 or NULL, and how many days quantity was 0 or NULL when day -1 quantity of product was 1
0 -
You are much better off 'architecting' a physical data structure that records the PRODUCT, DAY, QUANTITY, PREVIOUS DAY QUANTITY, LAST NON-ZERO DAY
Have a row for EVERY Product and Day ... now you have no nulls only zeros for appropriate day.
PREVIOUS DAY QUANTITY = LAG(QUANTITY) OVER(PARTITION BY PRODUCT ORDER BY DAY)
LAST NON-ZERO DAY = (SELECT MAX(DAY) FROM TABLE WHERE PRODUCT = x.PRODUCT and QUANTITY > 0)
^ a sub-select in the row will get you this
0 -
Thanks Thomas
0