Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Total sales

Hi

I have Unit number , Date, Sales fields, I would like to calculated sum of sales for each unit number , from the minimum date of each department number to select no of months.

ex:   I have Unit 1 in the year 2004/jan/25 sale $100, for the same Unit on 2004/feb/21 I have sale say $200 and for the

  Unit 2 in the year 2006/<mar/25 sale $50, for the same Unit on 2007/Apr/19 I have sale say $250

now I would like to calculate a field on Date which will give me  First 2Month, 4monts, 6Month, .....>24Month.

if I select on first 2Months I would like to see

for Unit number 1  Sale 300

for Unit number 2  Sale 50

Can any one help on this.

Please find the sample data on attachment.

Thanks

John

23 Replies
Not applicable
Author

Yes Your Correct, sum would be 116. 

sunny_talwar

This?

Capture.PNG

Not applicable
Author

Yes Sunny ,it seems working, however this functionality I want to implement with out these flags, just I need one field which contains  first 1 Month, first 2 Months ..........up to today whatever the month it is, ideallyy autonumber(MonthName(Date),'MN');

I want to calculate a field which gives me a distinct number for each month through out all the years up to today for all the units.

then if I click on that field I would like to see those many months of data for each unit from its minimum date. 

PradeepReddy
Specialist II
Specialist II

see the attachment, it might be helpful for you.... it is similar to sunindia

I have add crosstable, to convert all the period fields into into one field.

sunny_talwar

Another way:

sasikanth
Master
Master

HI,

Try this

Expression,

=sum(if(Date>=MonthStart(mindate)and Date<=MonthEnd(AddMonths(mindate, vMax)),  Sales))

PFA for details

Not applicable
Author

Sunny in the above attachment  1st Month Results are not populating.  also there are some Year month values also missing .

here I am attaching a work around ,please find it , there is a bug on it I am getting values individually for every period, however when we are not selecting the period the amounts are showing huge for every unit. also please kingly let me know can I do it in more optimal way? actually the file size is 2.7 MB but now it has moved to 77 MB so some where I did mistake please kindly provide me a thought.

swuehl

tresesco‌maxgro

hic

Thanks

John

sunny_talwar

I see that you are using CrossTable() in the script. What exactly are you trying to do there? Are you using the solution proposed by Pradeep? He might be able to help you better if you are using his way of doing it?

sunny_talwar

You had 435,278 observations in your Excel File and after your script ended the number of observation increased to 33,081,128 (which equals the number of observations * No. of Period you have created). This is the reason the file size increased from 2.7 MB to 77 MB here.

Not applicable
Author

Yes , there is the problem.