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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparable period in previous fiscal year, using variable for period

Hi,

I'm having some trouble combining 2 expressions in order to give me data from a select period in our previous fiscal year. The first expression returns data from our previous fiscal year (in 2009-2010 format):

=Sum({$<[Fiscal Year]={"$(=Only((SubField([Fiscal Year],'-',1) - 1) & '-' & (SubField([Fiscal Year],'-',2) - 1) ))"}>} [Equivalent Units] )

The second expression forces a select period based on a variable called PVar, which is a period 1-12:

=Sum({$<[Period]={$(PVar)}>} [Equivalent Units])

Both expressions work seperately. Does someone know how I might combine them to return the data for the select Period of the previous Fiscal Year?

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

try adding the [Period]={$(PVar)} in the first expression:

Sum({$<[Fiscal Year]={"$(=Only((SubField([Fiscal Year],'-',1) - 1) & '-' & (SubField([Fiscal Year],'-',2) - 1) ))"},

[Period]={$(PVar)}>} [Equivalent Units] )

Hope this helps

Regards!

View solution in original post

2 Replies
Not applicable
Author

Hi,

try adding the [Period]={$(PVar)} in the first expression:

Sum({$<[Fiscal Year]={"$(=Only((SubField([Fiscal Year],'-',1) - 1) & '-' & (SubField([Fiscal Year],'-',2) - 1) ))"},

[Period]={$(PVar)}>} [Equivalent Units] )

Hope this helps

Regards!

Not applicable
Author

Thanks Gabriela,

I had been attempting to add the two together but couldnt understand which brackets to leave in, and which to remove. This works perfectly.Thanks again.