Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

match

Hi,

I have variables as follows:

vCurrentYear=Year(Today())

vPreviousYear=Year(Today())-1

The script as:

LOADDistinct
    [Year Count] as [Year],
    [From Month],
    [From Month No],

FROM Calender_Dimension.qvd(qvd)

where Match(year([Calendar Date]),'$(vCurrentYear)','$(vPreviousYear)');

when i reload it is throwing error.

can any 1 tell y?

Labels (1)
17 Replies
mohamed_ahid
Partner - Specialist
Partner - Specialist

you schould add Match(year([Calendar Date]),'$(vCurrentYear)','$(vPreviousYear)')=1 or 2 .depending on which year you want to filter data .

check help (F1) for more explication nabout match function .

Not applicable
Author

s they r typo graphical errors

Not applicable
Author

i have years from 1980 to 2020 i cant use >= and <= i have to use match.

buzzy996
Master II
Master II

r u tried tis way,

Match(year([Calendar Date]),Year(Today() ),Year(Today() - 1)) --some how work around.

the problem with ur match function syntax.

Anonymous
Not applicable
Author

Hi,

can you modify your script by this one?:

LOAD Distinct Year Count] as [Year],

  [From Month],

  [From Month No]

from Calender_Dimension.qvd(qvd)

where year([Calendar Date]) >= $(vPreviousYear) and year([Calendar Date]) <= $(vCurrentYear)

**Notice that I removed the comma after the [From Month No] field, it could be the main error

**Also i removed the single quote of the variables

Please, check it and modify what you need, but I think this is the way

tamilarasu
Champion
Champion

Hi Prudvi,

Check the below script,

vCurrentYear=Year(Today());

vPreviousYear=Year(Today())-1;

LOAD Distinct

    [Year Count] as [Year],

    [From Month],

    [From Month No]

FROM Calender_Dimension.qvd(qvd)

where Match(year([Calendar Date]),'$(vCurrentYear)','$(vPreviousYear)');

effinty2112
Master
Master

You could use this variable

vFromDate=YearStart(Year(Today())-1);

With this Where clause

FROM Calender_Dimension.qvd(qvd)

where [Calendar Date] >= $(vFromDate);

Not applicable
Author

Hi all, i tried in the same way for which i marked as correct answer ; the only wrong was that my file was a corrupted one.....

I made it new n its working fine.

once again thanks to this huge response:)