KPI indicator for QlikView report update status. (Weekly and monthly updated) - qlikview

I have two reports, one that is updated monthly from the source, and one that is updated once per week.
I have a KPI report that I want to show red/green indicators if the report is updated this month/this week.
The last updated date is stored in a table and is loaded into QlikView. QVD_Id is the id of the QV report.
The monthly report is beeing updated around the 10th each month. I have created this set analysis that seems to be "almost" working.
=if(Max({<Day=, Date=, QVD_Id={1}, MonthCounter={"<=$(#max(MonthCounter))"}>} num(Date(Updated))-1,00) >= num(Dato),0,1)
What I ultematly want for this indicator, is for it to be red if has not been updated within a month, or actually if its not updated within the 6th working day of the month it should be red(But this requered som additions to the dimensions that I can do later).
I tried to do the same for the weekly report, but its not working:
=if(Max({<Day=, Date=, QVD_Id={2}, WeekCounter={"<=$(#max(WeekCounter))"}>} num(Date(Updated))) >= num(Dato),0,1)
What I want with the weekly updated report, is that it should be red if it's not updated by the 2nd day of the week(Tuesday).
Example of the facttable used:
QVD_Id TotalLoad LoadYear LoadMonth LoadDay LoadHour Updated Date_Lnr Source
1 200000 2014 2 5 10 .02.2014 10:56:31 19759 Source1
WeekCounter is 58 this week, and MonthCounter is 2. (WeekCounter is just continiuing from last year but that does not matter here).
Hope any of you have some more experience then me with this and can find a solution for this.

i think this is close to what you want:
// check is date less than the 6 in the month and not larger than max date -1 month
if(num(weekday(Max(Date))) <= 6 and
num(weekday(AddMonth(Max(Date),-1))) <= num(weekday(Max({$}Updated))), 1,0)

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.

SQL - SUM two columns with a date range on one of the columns

First off its been a long week and I'm having a moment e.g. I just can't figure this out but I know its straight forward.
I have a CTE with a query for a GL Detail and one for Budget which are bought together to display all the details needed for a report.
For example the GL detail bring back the actual amount from a date range such as 2019-01-01 and 2019-04-01
and the budget part brings back the budget for each month so the date range is 2019-01-01 and 2019-12-01 as I need to sum up the total budget in a report.
Using an iif expression in SSRS the report shows the actuals up to the month a user select (there is on a to_date parameter)such as April then the report shows actual from Jan and then budget from May to Dec. I need to show the total of budget for the 12 month which is straight forward as I have bought each month amount back.
My question is I need to sum the GL actual amount for the months selected in by the user Jan to April and the remaining budget amounts May to Dec. For some reason I just can't work it out in my head.
Edit - I'm using
postgresql
SSRS - Microsoft SQL Server Reporting Services
columns are in GL is gldetail.amount and for Budget budget.amount_budget - I have a column in both gldetail and budget queries which is called post_date.
Worked it out -
,case
when src.post_date <= src._to_date then src.amount
when src.post_date > src._to_date then src.amount_budget
end as actual_budget_total
Then in the report sum the actual_budget_total

Qlikview Rolling 52Wk Report

I have a strange issue with Qlikview with a rolling 52 Week report that show sales units for items which works back from the current week (39) to week 40 of previous year. What is happening is that if an item has 0 sales for the week it populates the current week data with data with sales from a previous week. Example:
Week 39 (Current Week) had 0 sales of an item.
On my Qlikview table it kept the week 39 label but populated the sales data from the previous week (38) as there was sales. I have checked all of the table properties and unchecked suppress zero values, show all values etc.
How do i stop the table from hiding 0 values if there is no sales for the current week?
Thanks

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))

Tabular Query to Compare Measures Across Dates

I've got a number of rows and I want to calculate the difference per date.
So say I have the following:
[Date] [Transaction Number] [Value]
1 Jan 16 1 1000
2 Jan 16 1 980
I then want a fact that for every row will compare the value with the measure from the previous date.
So If I have a measure on SUM(Value) for the current date, I basically want SUM(CurrentDate) - SUM(PreviousDate) to see the movement.
A couple of things to note:
There will actually be a couple of comparisons: previous date, previous month end, previous year end.
I want this as a calculated measure not column so that I do not need to filter on the transaction number in the previous period.
What I've tried but it just comes up empty:
Previous Value :=CALCULATE(SUM(Table[Value])) - CALCULATE(SUM(Table[Value]), FILTER(Table, Table[Date] = PreviousDay(Table[Date])))
Unfortunately I cannot tell why your measure didn't work, but following should:
Previous Value := CALCULATE(SUM(Table[Value]) - CALCULATE(SUM(Table[Value]), PREVIOUSDAY(Table[date])))