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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
smilingjohn
Specialist
Specialist

dt

I have a date filed as Date which has data from 2001 to till date ..

this field iam using it in the Dimesnion .

I want to show only 2 years data like ( from jan-2015 , Feb-2015.....till date )

How should i achieve this .

Labels (1)
15 Replies
smilingjohn
Specialist
Specialist
Author

Hi ANand please find the attachment of the QVW file ..

In dmesions i want to show from today till 2 years back data in the bar chart ...

its_anandrjs
Champion III
Champion III

May be this then, also wait for SET analysis solution

smilingjohn
Specialist
Specialist
Author

HI Anand

If i go in 2018 then again manaully i have change this ..

Is there no default solution for this ..

Where from current year it should shwo me last two year range

its_anandrjs
Champion III
Champion III

For dynamically though you have to create variables

vCurrYr =Year(Max(Created))

vPrevYr=Year(AddMonths( Max(Created),-12))

vPrevPrevYr=Year(AddMonths( Max(Created),-24))

And then

Dim :- =If(match(Right(monthname(Created),4),$(vPrevYr),$(vPrePrevYr)),MonthName(Created))

Expre:- Sum(1)

its_anandrjs
Champion III
Champion III

Or another way is you can use the Year field but you have to add this field on your data model

Load

Created,

Year(Created) as CreatedYear

From ....

Dim:-  Year

Expre  =Sum({<CreatedYear={">=$(=Max(CreatedYear)-2)"}>}1)

smilingjohn
Specialist
Specialist
Author

Hi anand

I have created the variables,

And when i add this expression ( logic ) in the dimesnion its showing error in the dimension

=If(match(Right(monthname(Created),4),$(vPrevYr),$(vPrePrevYr)),MonthName(Created))

Iam doing something wrong ?