Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date comparisions

Hi there.

I'm quite new to Qlikview.

I have a basic question.

Let's say this is my database

MonthYearPeriodValue
11201011.201035
12201112.201138
12011  1.201150
22011  2.201133
32011  3.201134
42011  4.201148
52011  5.201147
62011  6.201143
72011  7.201130
82011  8.201141
92011  9.201142
10201110.201135
11201111.201132

After import I have a month, year, period the value field.

What I want to do now, is creating a chart, with dates correct ordened, so like this :

value.JPG

How do I do that? because qlikview sorts the row values from 1 to 10, which means that 11.2010 is at the back together with 11.2011

Thanks!

8 Replies
Miguel_Angel_Baeyens

Hi,

I'd create a field date, which is dual (literal representation, numeric value) so you can sort by this field instead:

Data:

LOAD *, MakeDate(Year, Month) AS Date INLINE [

Month, Year, Period, Value

11, 2010, 11.2010, 35

12, 2011, 12.2011, 38

1, 2011, 1.2011, 50

2, 2011, 2.2011, 33

3, 2011, 3.2011, 34

4, 2011, 4.2011, 48

5, 2011, 5.2011, 47

6, 2011, 6.2011, 43

7, 2011, 7.2011, 30

8, 2011, 8.2011, 41

9, 2011, 9.2011, 42

10, 2011, 10.2011, 35

11, 2011, 11.2011, 32

];

Now, although the chart will look like the same, go to teh chart properties, Sort, and sort Numeric Ascending or Expression, Ascending, Date.

Hope that helps.

Miguel

Not applicable
Author

Hi there,

I would use the dual()-function similar to this:

Load

. . .

    dual(Month(RawDate) & '-' & Year(RawDate), Year(RawDate) & num(Month(RawDate),'00'))

                                            AS Period,

. . .

The dual() creates a numeric/text field "Period" similar to the Month()-function. Now users see the  string-representation of the "numeric" field but sorting can be done numerical.

HtH

Roland

Not applicable
Author

Roland,

Does QlikView recognises Rawdate or do I have to declare it somewhere?

Thanks!

Not applicable
Author

how stupid of me, now i understand it , sorry Roland

Not applicable
Author

Hi,

QV doesn't know RawDate as it is a field copied out of one of my load-scripts.

The first parameter of function Dual() is the textual reps of the generated field, second parameter is the internal numeric value.

In your case replace

dual(Month(RawDate) & '-' & Year(RawDate) . . .

with sth like

dual(Period, SubField(Period,'.', 2) & num(SubField(Period,'.', 1))) AS Period,

. . .

Roland

Not applicable
Author

OK,

working in parallel, I was too late.

And...

meanwhile you managed it for yourself! No Problem.

So go on.

RR

Anonymous
Not applicable
Author

Hi,

     I have attached one example qlikview file for your referrence,May be it will helpful for you to get some idea about qlikview .

Anonymous
Not applicable
Author

Hi,

     Find the attached file may be this solution will be helpful for your doubt...