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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Edyta
Contributor III
Contributor III

Cannot get daily production in Qlik Sense

Hi guys,

I am trying to obtain simple pivot table in Qlik Sense. Everything is fine but I cannot get daily production in items.

Below is piece of raw data:

WEEKDAYMONTHYEARNUMBER OF ITEMSITEMS REJECTED
12120192 50412
12120193 75854
13120194 52232
13120195 21945
13120194 4205
141201931 29262
141201934 18454
141201930 57347

 

 

Below is the result is the pivot table - the last column AvgDailyItemsProduced is wrongly calculated by Qlik.

I also present how I get CountProductionDays and ItemsProduced:

CountProductionDays: count(distinct [DAY])

ItemsProduced: sum(NUMBER OF ITEMS)-sum(ITEMS REJECTED)

I also tried to get AvgDailyItemsProduced which is the sum of ItemsProduced/CountProductionDays:

sum(NUMBER OF ITEMS)-sum(ITEMS REJECTED)/count(distinct [DAY]) and I obtain wrong value

 CountProductionDaysItemsProducedAvgDailyItemsProduced
2019   
1225 156 325=ItemsProduced/CountProductionDays
2236 235 248=ItemsProduced/CountProductionDays
3245 902 647=ItemsProduced/CountProductionDays
4265 455 658=ItemsProduced/CountProductionDays

 

Could you help me with the issue?

Labels (2)
15 Replies
JordyWegman
Partner - Master
Partner - Master

Strange.. what happens if you make a text object and put the following statement: Count(Distinct {$< Year = {2019}>} DAY). Does this also return 31?

Can you maybe add a qvf?

Jordy

Climber

Work smarter, not harder
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Edyta,

If what you are saying is right the formula should work, however looking on your results it looks like you dont have distinct number for each day in year. It simply looks like you are counting distinct days of months instead of days of year. As this is data issue without sample it will be hard to answer your question. 

cheers Lech, 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 to the problem.
Edyta
Contributor III
Contributor III
Author

that's right. Apologies, I have not noticed it. I have number of week of of the year and number of day within month.

JordyWegman
Partner - Master
Partner - Master

Then try this formula again:

Sum(Aggr(count(distinct [DAY],Month))) 

Jordy

Climber 

Work smarter, not harder
Edyta
Contributor III
Contributor III
Author

Jordy almost correct, there should be closing parantheses after [DAY] and the last should be removed.

Guys, thank you very much for your help.

JordyWegman
Partner - Master
Partner - Master

Good, did this solve your problem? Then please mark the post as solved!

Jordy

Climber

Work smarter, not harder