Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
hadari
Contributor III
Contributor III

Set Analysis with Date Picker

Hi!

I have the following KPI:
=Sum({<Year={'$(vLastYear)'}>}TotalPriceBeforVat)

when I choose date by a date picker, for example oct 2019- 

I would like to get the sum of TotalPriceBeforVat of 2018.

my Variable vLastYear is equal to :year(max(Date))-1

I get 0 instead of an sum of TotalPriceBeforVat when I select the date by  a date picker but when I select another filter like month/year/week and so on I get the sales of the previous year as excepted, 

I have TotalPriceBeforVat in my date for 2018 so this is not the issue..
the issue is that it doesn't sums up when I choose my time period from the date picker specific.

even when I change the set analysis to: Sum({<Year={'2018'}>}TotalPriceBeforVat)- it gives me 0 as the output.

 

why It doesn't sum the  TotalPriceBeforVat  when I choose the period from m date picker?

 

Labels (4)
8 Replies
marcus_sommer

Before looking for any issues with the expression/variables take a look on the data - by using a table-box with Date + Year + TotalPriceBeforVat. Are there really the expected values?

hadari
Contributor III
Contributor III
Author

Hi,

Yes ,I can see data for 2018 when I choose the date through the date picker in the table.
The Top Kpi is 0 as I wrote before..
but when I choose the date by other date filter ( not the date picker) it's working..

hadari_0-1712661962014.png

 

marcus_sommer

Make sure that the field from the date-picker is related to the other period-fields. Otherwise you may need to change this field.

hadari
Contributor III
Contributor III
Author

It’s related since the variable lastyear is based on the date field and it gives the correct year..

marcus_sommer

If the variable really returned the shown result of 2,018 the expressions should fail. Try to adjust the result by adding: num(year(max(Date))-1, '0000')

hadari
Contributor III
Contributor III
Author

Hi,

It's still the same:

the ne

hadari_1-1712672586592.png

 

w lastyear variable:

hadari_0-1712672535216.png

the KPI:

 

Anil_Babu_Samineni

@hadari I can see that your variable returns 2,018, Do you have the expression how that is created?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
marcus_sommer

In regard to your origin statement of:

" ... even when I change the set analysis to: Sum({<Year={'2018'}>}TotalPriceBeforVat)- it gives me 0 as the output ..."

start again by checking your data-set because if a hard-coded '2018' didn't work it means that your issue isn't mainly related to the variable.

Especially take a look if you have appropriate data for 2017 which would be related as previous values for 2018.