Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sanjujeeboy
Creator
Creator

Populate data according to user date selection

hi all,

i want to acheive the following layout in qliksense.

there are two date filters : Period 1 and Period 2 . The user selects the respective periods and the data should be populated as below.  how to achieve this?

 SpendRevenue
Period 1 - 1/1/2020 - 1/8/2020100500
Period 2 - 1/9/2020 - 1/16/2020150700
Difference %50%40%

 

Labels (3)
1 Reply
shwethaa
Contributor III
Contributor III

Hi,

Create Inline load in the editor with 3 value like:

 

Load * inline [
Dimension_Field
Period1
Period2
Difference];

 

 then create 4 variable in front end which specify the date range(vDate1Start, vDate1End,vDate2Start,vDate2End)

In the chart add calculated dimension and measure as below

 

Dimension:
pick(Match(Dimension_Field,'Period1','Period2','Difference'),
'Period1 -'&'$(vDate1Start)'& ' - '& $(vDate1End),
'Period2 -'&'$(vDate2Start)'& ' - '& $(vDate2End),
Difference)

Measure:
pick(Match(Dimension_Field,'Period1','Period2','Difference'),
Sum({<Date={">=$(vDate1Start)<=$(vDate1End)"}>}Measure_Field),
Sum({<Date={">=$(vDate2Start)<=$(vDate2End)"}>}Measure_Field),
Sum({<Date={">=$(vDate1Start)<=$(vDate1End)"}>}Measure_Field)
-Sum({<Date={">=$(vDate2Start)<=$(vDate2End)"}>}Measure_Field)
)

 

 Let me know if this works or require any other details.