Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've got this excel sheet among other things a column with payment dates. I want to use this info in a listbox so that I can see sales figures for a certain month in a diagram.
I've figured out how to get just the month in a text format (jan, feb, etc) but the problem is I get every instance of the months displayed, so there is a whole lot of jans, febs etc seen where as I just want one instance of each so that I can choose for example may and then get the sales total for the month of may.
I don't know if I explained this well enough, but hoping that I have, is there anyone out there who can give me any tips?
Thanks!
When loading the script:
Sometimes its best to create a seperate Date_Table and then link this to (for example) the orders table.
By using this it allows the developer to manipulate dates easily
Date:
load
today()-recno()+1 as Date
autogenerate(today()-'2002-12-31');
DateParts:
load
Date as invoice_date, // link to orders_table
Day(Date) as Day,
Year(Date) as Year,
yearname ( Date, 0, 4 ) as FinancialYear,
weekstart(Date) as WeekStart,
Month(Date)&' - '&right(year(Date),2) as MonthYear,
Month(Date) as Month,
Week(Date) as Week,
Weekday(Date) as WeekDay
resident Date;
drop table Date;
Then when you create list boxes of dates or date format the duplication will not occur.
When loading the script:
Sometimes its best to create a seperate Date_Table and then link this to (for example) the orders table.
By using this it allows the developer to manipulate dates easily
Date:
load
today()-recno()+1 as Date
autogenerate(today()-'2002-12-31');
DateParts:
load
Date as invoice_date, // link to orders_table
Day(Date) as Day,
Year(Date) as Year,
yearname ( Date, 0, 4 ) as FinancialYear,
weekstart(Date) as WeekStart,
Month(Date)&' - '&right(year(Date),2) as MonthYear,
Month(Date) as Month,
Week(Date) as Week,
Weekday(Date) as WeekDay
resident Date;
drop table Date;
Then when you create list boxes of dates or date format the duplication will not occur.
I am pretty much a beginner to QlikView. I've tried the code above in the script window but I get an syntax error message saying there's a missing/misplaced load:from statement and I have no idea what that means.
Could you perhaps add a few more comments to the code? I'm guessing there is no way to just manipulate the listbox properties to achieve this?
It's probably a field definition problem, not a listbox problem. You could manipulate the listbox, but that's not really the right solution.
My guess is that you're doing something like this:
date(MyDate,'MMM') as Month
The problem with that is that all dates are still stored as dates, regardless of how you display it. The 'MMM' is only telling it how you want to see it on the screen. So September 1, 2008 will still be different than September 2, 2008 will still be different than September 2, 2009. As a result, you'll see Sep repeated in your list box for every date in September of any year.
If you want all dates in September of any year to be equivalent, use this:
month(MyDate) as Month
The month() function drops the date information, and stores only an integer month (1-12) with a display format of MMM.
If you want all dates in September of EACH year to be equivalent, but different from September in other years, use this:
date(monthstart(MyDate),'MMM YY') as Month
The monthstart() function forces all dates in the month to have the same value.
At the risk of seeming completely illiterate, I must admit I can't get it to work.
In the excel sheet I'm importing there is in addtion to the column "invoice date" also a column called "Month" which is derived from Invoice date, but of course lists only the month in a MMM-format.
So, is it the wrong way to go about it to import that column and try to get that into a listbox which only has one instance of every month displayed? Should I, delete this column from the sheet and extract the month-bit from the invoice date-column? I really need all the help I can get as I'm stuck and this is part of an assignment I have to hand in at the latest tomorrow.
Can you load the document and I can have a look at the script!
I hope I understood you correctly. I loaded the file into QV and below is the copied script. The column invoice date corresponds to UCIVDT. If I have completely misunderstood you, then my excuse is that after an all-nighter in front of the computer my brain is mush.
UCCUNO,UCIVNO
,
UCIVDT
,
UCORNO
,
UCITNO
,
UCORTP
,
UCSMCD
,
UCWHLO
,
UCSAAM
,
UCUCOS
,
UCIVQT
,
UCDIVI
,
UCCONO
,
MONTH
,
YEAR
FROM
(
biff, embedded labels, table is Sheet1$);
LOAD
Can you upload the document.
The instructions are in the attached file
Ok, am with you now. Here's the excelfile.
Sorry,
I meant the qvw (qlikview) file