Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

displaying an AVG rent trend of lease assets in a period in a line chart

ContinentCountryCityLease BeginLease EndPrice per monthRentable area
AsiaJapanTokyo01.01.201131.12.2016100005000 m²
AsiaChinaHongkong01.03.201128.02.201795005000 m²
AsiaChinaShanghai01.05.201131.12.2016113005000 m²
EuropeGermanyBerlin01.05.201031.12.2013120005000 m²
EuropeFranceParis01.01.201331.12.2013135005000 m²
North AmericaUSAWashington D.C01.01.201231.12.2015100005000 m²
North AmericaUSAPhiladelphia01.01.201231.12.2015121005000 m²
North AmericaCanadaMontreal01.01.201031.12.2015110205000 m²
South AmaricaBraziliaSao Paolo01.01.201131.12.201695105000 m²
South AmaricaCosta RicaSan Jose01.01.201131.12.201680005000 m²
AfricaCape TownBellville01.01.201231.12.201760005000 m²
AfricaNigeriaAbuja01.01.201231.12.201754805000 m²
AfricaCote d'IvoireAbidjan01.01.201231.12.201765005000 m²
AustraliaSydneyBlacktown01.01.201331.12.2018115205000 m²
AustraliaNewcastle CityNewcastle City01.01.201331.12.2018101205000 m²

How can I create a line chart where I can see the avg rent for each continent in a period from 01.XX.XXXX till 31.YY.YYYY

?

6 Replies
sunny_talwar

What does 01.xx.xxxx and 31.yy.yyyy means? Can you elaborate on this? Also if you can provide the expected output for the sample provided above, we might be able to understand the requirement better

thanhphongle
Creator II
Creator II
Author

01.xx.xxxx = Date begin for example 01.10.2010 , 31.YY.YYYY = End Date for example 31.12.20117

I want to compare the avg cost in this period with othere continents.

I have a bigger database where rents begin at 01.01.2019 or later. But i want to exclude them from the period. because it could have an effect on my avg price

thanhphongle
Creator II
Creator II
Author

And another interesting thing is.

We know the price per month is constant from the lease begin till the lease end.

So it would be interesting to to compare the average price per month with other continents in a certain period

sunny_talwar

From the data provided what number or numbers do you expect to see as your output?

thanhphongle
Creator II
Creator II
Author

for example:

Period = 01.01.2015 - 31.12.2016

Asia AVG(Price) = AVG(10000+9500+11300) = 10266,66

Europe AVG(Price) = 0 because out of period

North America AVG(Price) = AVG(10000+12100+11020) = 11040

South America AVG(Price) = AVG(9510+8000) = 8755

Africa AVG(Price) = AVG(6000+5480+6500) = 5993,33

Australia AVG(Price) = AVG(11520+10120) = 10820

Max(AVG(Price) is in North America

Lowest(AVG(Price) is in Africa

effinty2112
Master
Master

Hi Thanh,

                    A load script like this will create a calendar associated with your fact table by an IntervalMatch

Data:

LOAD Continent,

     Country,

     City,

     Date#([Lease Begin],'DD.MM.YYYY') as [Lease Begin],

     Date#([Lease End],'DD.MM.YYYY') as [Lease End],

     [Price per month],

     [Rentable area]

FROM

[https://community.qlik.com/thread/223428]

(html, codepage is 1252, embedded labels, table is @1);

tblMinDate:

LOAD Min(Id) as MinDate;

LOAD FieldValue('Lease Begin', recno()) as Id

AUTOGENERATE FieldValueCount('Lease Begin');

tblMaxDate:

LOAD Max(Id) as MaxDate;

LOAD FieldValue('Lease End', recno()) as Id

AUTOGENERATE FieldValueCount('Lease End');

LET vStartDate =PEEK('MinDate',0,'tblMinDate');

LET vEndDate =PEEK('MaxDate',0,'tblMaxDate');

DROP tables tblMinDate,tblMaxDate;

[Calendar]:

LOAD

*,

Ceil((PeriodID+1)/3) as QPeriodID

;

LOAD

*,

AutoNumber(MPeriod, 'MPeriodID') as PeriodID

;

Load

Year(Temp_Date) * 100 + Month(Temp_Date) as MPeriod,

  Year(Temp_Date) & 'Q' & Ceil(Month(Temp_Date) / 3) as QPeriod,

  Year(Temp_Date) & 'W' & Right('0'&Week(Temp_Date),2) as WPeriod,

  Date(Temp_Date-WeekDay(Temp_Date),'DD/MM/YYYY') as WeekBeg,

  Year(Temp_Date) as Year,

  if (Ceil(Month(Temp_Date) / 3)=1,Year(Temp_Date)-1 & '/' &

  Year(Temp_Date), Year(Temp_Date) & '/' & Text(Year(Temp_Date)+1) ) as [FinYear],

  'Q' & Ceil(Month(Temp_Date) / 3) as Quarter,

  Week(Temp_Date) as Week,

  Div((Temp_Date-$(vStartDate)),7)   as WeekID,

  Month(Temp_Date) as Month,

  Month(Temp_Date)  & ' ' & Year(Temp_Date) as MthYear,

  Date(Temp_Date,'$(DateFormat)') as Date;

Load $(vStartDate) -1 + IterNo() as Temp_Date

AutoGenerate 1 While $(vStartDate) -1 + IterNo() <= $(vEndDate) ;

IntervalMatch(Date) LOAD [Lease Begin], [Lease End] Resident Data;

You have a choice of date dimensions to choose from for a chart. This is avg price by year and continent.

1.JPG

Cheers

Andrew