Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
patrou38
Creator
Creator

Sum quantity

Hello,

I have a table in which there are a quantity of equipment by week (February weeks in my example).

in another table I would like to have the sum of qty by month.  I don't find the expression, the aggr ????

I expect that I'm enough clear.

than you for your help.

Patrick

1 Solution

Accepted Solutions
sunny_talwar

Oh... I see that you are doing a Distinct count... I am not sure why you need a DISTINCT... but if you need that... may be try this

Sum({<Facility = {'$(vFacility)'}, ModelFamily = {'$(vModelFamily)'}>} Aggr(Sum(DISTINCT {<Facility = {'$(vFacility)'}, ModelFamily = {'$(vModelFamily)'}>} [TC inventory]), Year_Week, Year_month))

View solution in original post

12 Replies
dapostolopoylos
Creator III
Creator III

If there is a Month filed in the Data Model all you have to do is to bring it in your chart instead of Year-Week field...

If you don't have a Month field i suggest you to create it...

Father/Husband/BI Developer
patrou38
Creator
Creator
Author

Hello, I tried without success as you can see below 

QTY.JPG

dapostolopoylos
Creator III
Creator III

You must have done something wrong with your date fields...

Can you share your script or at least the part where you create your date fields?

Father/Husband/BI Developer
patrou38
Creator
Creator
Author

ciao Dimitrios,

below my script.

thank you very much for your help.

I had in mind that the problem coming from my script

QTY2.JPG

dapostolopoylos
Creator III
Creator III

What i want you to show me is how you create the Calendar fields and most of all the Work_Week field which is your key

Father/Husband/BI Developer
patrou38
Creator
Creator
Author

ok.

the calendar is defined in an excel file like this:

QTY3.JPG

dapostolopoylos
Creator III
Creator III

Your calendar seems to be allright...

Did you use the Sum() function when yoyu tried to replace Year_Week with Year_Month in your chart?

Father/Husband/BI Developer
patrou38
Creator
Creator
Author

I'm using the same expression for the both .. .either for week or for month ....

QTY_week.JPG

sunny_talwar

Would you be able to share your Excel file by attaching it here

Uploading a Sample