Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi There,
I'm hoping this will be a fairly easy one for you guys.
I'm trying to create a simple straight table that shows the count of compliance against the count for 7 days ago (ultimately i then want to be able to show a little up green or red down arrow next to it)
I can see the current count with this expression:
Count([Name])-Count({<[Name]={"Unknown"}>}[Name])
But when i try this (which i thought it might be) it correctly shows the date as 7 days prior but the count is empty.
=count(>=$(=(Date(Today()-7)))
=Count([Name])-Count({<[Name]={"Unknown"}>}[Name])
Its ok,
With the help of our supplier a solution has been created:
In the script we wrote this:
Let vLastWeekStart = Date(WeekStart(Today())-7,'DD/MM/YYYY');
Let vLastWeekEnd = Date(WeekStart(Today())-1,'DD/MM/YYYY');
Let vLastWeekStart2 = Date(WeekStart(Today())-14,'DD/MM/YYYY');
Let vLastWeekEnd2 = Date(WeekStart(Today())-8,'DD/MM/YYYY');
and then:
Date#(Date([Date/Time left ward],'DD/MM/YYYY'),'DD/MM/YYYY') as [Date/Time left ward],
If(Date#(Date([Date/Time left ward],'DD/MM/YYYY'),'DD/MM/YYYY') >= '$(vLastWeekStart)',
if(dATE#(Date([Date/Time left ward],'DD/MM/YYYY'),'DD/MM/YYYY') <= '$(vLastWeekEnd)', '1','0')) AS [Last Week Flag],
If(Date#(Date([Date/Time left ward],'DD/MM/YYYY'),'DD/MM/YYYY') >= '$(vLastWeekStart2)',
if(dATE#(Date([Date/Time left ward],'DD/MM/YYYY'),'DD/MM/YYYY') <= '$(vLastWeekEnd2)', '1','0')) AS [Previous Week Flag],
Which meant we just needed to add this expression into the table to show the total counted Last Week:
=Count({<[Questions Complete]={'Yes'}, [Last Week Flag]={'1'}>} [Questions Complete])
I can't say I fully understand all the syntax but it works (and I will keep working on it so that I can 'get' what's been done.
Thank you so much to everyone that's helped, you're all fab!
did you try this?
count({<Date={'>=$(=(Date(Today()-7))<$(=(Date(Today())'}>}Name)
Hi Peter,
The master calendar is a table that contains all the dates of the one year and all the following that you want. That way you link the field dates of your table with the table of the calendar and thus you will obtain all the months, years semes, trimenestres, cuatrimestres, etc. Copy and paste the next script in a new qlikview document, run the script and load in your app, make sure that the format date its the same that you have in your tables:
The scipt to generate this is the next:
FOR i = 2018 TO 2028 //Put here the initial year that you want to star the calendar to the last one
LET curYear = $(i);
LET StartDate = makedate(curYear);
LET YearEnd = yearend(StartDate);
LET TotalDays = (YearEnd - StartDate) + 2;
TempCalendar:
LOAD
date('$(StartDate)' + recno() - 1) AS PeriodDate
AUTOGENERATE(TotalDays - 1);
Next
Calendario:
Load
PeriodDate AS %DATE,
Year(PeriodDate) AS YEAR,
num(month(PeriodDate)) AS MONTH, //Number format
DUAL(text(date(PeriodDate,'MMM')),num(month(PeriodDate))) AS MES, //Alfabeth format
DUAL(date(PeriodDate,'MMM') & ' ' & date(PeriodDate,'yyyy'),
Year(PeriodDate)*100+NUM(Month(PeriodDate))) AS MES_AÑO, // Month and year
WeekDay(PeriodDate) AS WEEKDAY,
num(Week(PeriodDate),'00') AS WEEK, //Number format
num(Day(PeriodDate),'00') AS DAY,
CEIL(Num(Month(PeriodDate))/3)&'°T' AS TRIM, //Quarter
num(weekday(PeriodDate)) AS DIA_NRO,
if(num(weekday(PeriodDate)=6) OR num(weekday(PeriodDate)=0),0,1) AS WORKINGDAY
Resident TempCalendar;
STORE Calendario into C:\Nube\Wicham\Qapacitacion\Practicas\Calendario\CalendarioLargo.qvd(qvd);
DROP TABLE Calendario;
DROP TABLE TempCalendar;
Let me know if it helps you, another way share some data to solve your problem