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: 
kprotrka
Contributor III
Contributor III

Date Range Field

I need to create on filed wit the date ranges.
should be like this:
if(date>31.03.2020 and date<01.04.2021,'old',
if(date>30.09.2020 and date<01.10.2021,'new')
as New_Old
 
My problem is that i have one period(01.10.2020-01.04.2021)...where it should take both ranges.
 
I need to do some calculations after(sum,avg...) and some projects and sums should be in both(old and new). Now i am getting those projects only in "old".
 
Any idea how to solve it?
2 Replies
rubenmarin
MVP
MVP

Hi, if you want one record with two possible values I think the best option is to use an additional table to avoid duplicated records.

So if you have a projects table with ProjectId as unique identifier of the project, you can add a related table like:

NewOld_Table:
LOAD
  ProjectId,
  'old' as New_Old
Resident Projects 
Where date>'31.03.2020' and date<'01.04.2021';
Concatenate
LOAD
  ProjectId,
  'new' as New_Old
Resident Projects 
Where date>'30.09.2020' and date<'01.10.2021';

 

vinieme12
Champion III
Champion III

flag the Old and New date ranges in your master calendar and then crosstab it

similar to this

https://community.qlik.com/t5/QlikView-Documents/Period-Presets-Compare-Periods-on-the-fly/ta-p/1486...

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.