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: 
Jamie_Jimi
Contributor
Contributor

Set a Fiscal Quarter in Variable

Dear all,

I would like to calculate a Quarterly Amount (For exmaple Q1)

My year end is on the July, so Aug,Sep,Oct will be my Q1.

I created  Sum({$ <[Year Quarter]={'Q1-FY2021'}>} [Total_Amount]) in Measure 

But when i try to replace 'Q1-FY2021' to Variable (vLastQ = 'Q1-FY2021') , it show no result

 

Thanks for you help!!🙏

Labels (2)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

Sorry, my initial post left out the closing ">}" of the set analysis.  Based on your screenshot, this should work.

Sum({$ <[Year Quarter]={$(vLastQ)}>} [Total_Amount])

View solution in original post

4 Replies
GaryGiles
Specialist
Specialist

If your variable is defined with singles quotes, the following  $-Expansion should work:

Sum({$ <[Year Quarter]={$(vLastQ)} [Total_Amount])

If your variable does not contain single quotes, your would need to supply them.

Sum({$ <[Year Quarter]={'$(vLastQ)'} [Total_Amount])

Jamie_Jimi
Contributor
Contributor
Author

Hi GaryGiles,

I tried both Sum({$ <[Year Quarter]={$(vLastQ)} [Total_Amount]) and Sum({$ <[Year Quarter]={'$(vLastQ)'} [Total_Amount]) before but still not works.

You can refer to the following print screen that i did.

This the the formula that  I use (Last Q)This the the formula that I use (Last Q)VariableVariableThe formula of Last Q (Q1-FY2021) = Sum({$ <[Year Quarter]={'Q1-FY2021'&#125;>&#125; [Total_Amount]). But when replace the Year Quarter to Variable, there is no result (Last Q)The formula of Last Q (Q1-FY2021) = Sum({$ <[Year Quarter]={'Q1-FY2021'}>} [Total_Amount]). But when replace the Year Quarter to Variable, there is no result (Last Q)

GaryGiles
Specialist
Specialist

Sorry, my initial post left out the closing ">}" of the set analysis.  Based on your screenshot, this should work.

Sum({$ <[Year Quarter]={$(vLastQ)}>} [Total_Amount])

rubenmarin
MVP
MVP

Hi @Jamie_Jimi, if vLastQ has Q1-FY2021 as value, the expression should be: Sum({$ <[Year Quarter]={'$(vLastQ)'}>} [Total_Amount]) 

I forgot to refresh before posting, the answer from @GaryGiles  should work. It seems your variable name has an space, try creatinga  vriable without spaces, just vLastQ (instead of vLast Q).