Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

year-to-date and periodic via Indicator in Script

Hi,

I hope someone of you can help me.

We have reports where we define in the calculations year-to-date(YTD) amounts:

Example for YTD

=
((
sum({$ <Jahr = {$(=Only(Jahr))}, Monat = {"<=$(=max({<Jahr={$(=max(Jahr))}>} Monat))"}, balcode={$(BALCODE1)}, key_yr={$(=Only(Jahr))}, key_month={$(=Only(Monat))} >}[Saldenbetrag]*key_Proz)

Example for Periodic

sum({$ <Jahr={$(=Only(Jahr)-1)}, Monat={'*'}, El1_GRPCODE={'1KTO-BIL','1KTO-GUV'}, balcode={$(BALCODE1)} >}[Saldenbetrag])

The Issue is, that we sometimes need the YTD-View and sometimes only periodical view (in several reports).

Does someone of you maybe have an idea how to create a variable directly in the Script that defines periodic or YTD-View

So that I can easily Switch or Show both in one table?

Very much thanks in advance.

Chris

3 Replies
raajaswin
Creator III
Creator III

Hi Christian,

             I think you can do it in chart properties by enabling conditionally and setting a variable for that

Not applicable
Author

Hi aswin,

I thought of that too. But when I make a condition I have all calculations twice (one for YTD and one for periodic),

I wanted to get rid of the many calculations by using a defined string within the calculation for YTD and periodical View.

The optimal solution is a button that Switches between These two 🙂

How can I put a variable for that string (Monat = {"<=$(=max({<Jahr={$(=max(Jahr))}>} Monat))"},) directly in the script?

("Monat" is month, "Jahr" is Year)

Chris

raajaswin
Creator III
Creator III

Hi Christian,

      Try Let expression.. may be this can help you

store expression into variable