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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Amount savings & aggr function

Hello everyone,

I have a basic need which is to create 2 graphs (bar charts) one that shows the amount of money saved per day and the other the amount of expenses per day.

The table I have is something like this:

   

DateLabelAmount
30-06-2016A-73
30-06-2016B-24
30-06-2016S95
29-06-2016C38
29-06-2016E-5
29-06-2016E-42
29-06-2016T-53
29-06-2016Y-94
28-06-2016A-37
28-06-2016F38
27-06-2016A3476
27-06-2016E37

I tried to use aggr function but it does not give me the correct values.

The expression I used (dimension is the date of the day) is

=sum({$<Expense_or_Save={'Save'}>} Aggr(sum(   Amount), Label))

And I created Expense_or_Save dimension in the script (expense if amount is negative otherwise save)

I think I am using the aggr function in a bad way but I don't know what is wrong....

Thank you for you help !

M.

4 Replies
MarcoWedel

Hi,

maybe solutions could be:

QlikCommunity_Thread_241618_Pic3.JPG

QlikCommunity_Thread_241618_Pic4.JPG

QlikCommunity_Thread_241618_Pic5.JPG

QlikCommunity_Thread_241618_Pic6.JPG

or

QlikCommunity_Thread_241618_Pic1.JPG

QlikCommunity_Thread_241618_Pic2.JPG

hope this helps

regards

Marco

Not applicable
Author

Hi Marco,

Thank you for your reply, actually you made me realize I do not necessarily need aggr function.

But it is still not showing the correct results.

But probably the problem lies elsewhere:

I noticed when I put my data in a straight table with Dimension 'Date' and 'Label' and have the expressions:

Amount and sum(Amount)    that sometimes sum(Amount) equals 5 times the value of Amount, sometimes it is 4 times the value, sometimes 3 times the value, sometimes 2 times the value, sometimes equal.

I really don't understand...

Do you have an idea of the reason ?

MarcoWedel

Maybe you have multiple occurrences of the same records in your data.

Can you post a sample of your application?

thanks

regards

Marco

Not applicable
Author

Hi Marco,

Yes it was one the question I was asking to myself, don't I need a column with unique IDs every time I work with a data set ? I am not sure of the answer but I would say yes, and for this I planned to concatenate the Label&Date&Amount to be sur it creates a unique ID (there might be other option like create 1, 2 3 ID with a for loop but I am not familiar with this).

But then I was stopped there because my problem is that I use a code that helps me consolidate the different excels that I have in one folder automatically all in one single table in Qlikview. So I tried my concatenate function but don't know where to place it. And plus I realized not all my excels are loaded every time... even though it was working not that long ago.

I attached the QV Code and the extract excels (dummy data created but same file structure). Sorry for this but the app contains some information I cannot share.

I am really motivated to make this work !

M.