Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
deepika_gohil
Contributor
Contributor

Variable creation for past period

Hi,

I have a Bar graph where I have to show historical data for this I was planning to create 2 variables which show past period start date and end date. 

I have a date range from which the user can pick a start and end date to see the result. Below is the screenshot of my requirement.  

Capture.JPG

for current trend line chart I am using below mentioned formula

num(Sum({$<[Posting Date]={">=$(=vCYStartDate)<=$(=vCYEndDate)"} >} Revenue),'####.##')

Same formulas I am planning to use for historic trend but This 2 varialbes wont work.

CYStartDate - hard coded - 01/04/2018

CY end date - 31/12/2020

Request you to please help me with the formulas for past period variables.

I am trying with below but isnt working

VPyend date =date(addyears(max([Posting Date]), -1), 'DD/MM/YYYY')

when I try calling this variable in text and object but its not working.

vPYstart date - =date(MakeDate( subfield(vPYEndDate,'/',3),subfield(vCYStartDate,'/',2)),'DD/MM/YYYY')

Request you to please suggest...

Labels (2)
2 Replies
deepika_gohil
Contributor
Contributor
Author

Hi Sunny,

I have a Bar graph where I have to show historical data for this I was planning to create 2 variables which show past period start date and end date. 

I have a date range from which the user can pick a start and end date to see the result. Below is the screenshot of my requirement.  

Capture.JPG

for current trend line chart I am using below mentioned formula

num(Sum({$<[Posting Date]={">=$(=vCYStartDate)<=$(=vCYEndDate)"} >} Revenue),'####.##')

Same formulas I am planning to use for historic trend but This 2 varialbes wont work.

CYStartDate - hard coded - 01/04/2018

CY end date - 31/12/2020

Request you to please help me with the formulas for past period variables.

I am trying with below but isnt working

VPyend date =date(addyears(max([Posting Date]), -1), 'DD/MM/YYYY')

when I try calling this variable in text and object but its not working.

vPYstart date - =date(MakeDate( subfield(vPYEndDate,'/',3),subfield(vCYStartDate,'/',2)),'DD/MM/YYYY')

Request you to please suggest...

Anil_Babu_Samineni

If u want some person need help You can always tag them using @ option. This will notify to user.

For now, I've done for you @sunny_talwar 

BTW, What r u trying to achieve here using this expression?

num(Sum({$<[Posting Date]={">=$(=vCYStartDate)<=$(=vCYEndDate)"} >} Revenue),'####.##')

Those variables not working? If so, Can you simplify like this?

num(Sum({$<[Posting Date]={">=$(=Date(AddYears(vCYStartDate,-1)),'Same as Posting Date')<=$(=Date(AddYears(vCYEndDate,-1)),'Same as Posting Date')"} >} Revenue),'####.##')

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)