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

Sum hours for a week

How do I set up a bar chart to only sum my 'Timereported' field for a week at a time? Then change when the new week begins.

20 Replies
swuehl
MVP
MVP

Try a set identifier 1 in both set expressions, like

=count({ 1 <Date = {">=$(=weekstart(today(),-1))<=$(=weekend(today(),-1))"} >} distinct TechID)*40

Not applicable
Author

That works to keep the selection regardless of user selection.

Thanks for all your help. You're very helpful as always!

Not applicable
Author

Having a slight problem with the bar graph now.

I attached the .qvw again with the problem.

The bar chart should only be displaying 'target hours' for 'user group' that have distinct 'TechID's' and multiply by 40 hours.

So why does my bar chart have 'PS' labeled as 40 when if you go over to the Details tab, there are no 'PS' value in the UserGroup field?

swuehl
MVP
MVP

Some of your Dates in table TimeLog2 are in fact timestamps and don't link to your calendar.

Use

daystart(TimeLogDate) as Date,

to create a date without a time part (maybe add a date() around for formatting).

Regards,

Stefan

Not applicable
Author

This would be in the script?

swuehl
MVP
MVP

Yes, do this in the load script (as a hint, as can only be used in the script). Just replace your TimeLog2 Load line

TimeLogDate as Date,

with

daystart(TimeLogDate) as Date,

or

date(daystart(TimeLogDate)) as Date,

Not applicable
Author

That did not work. The 'PS' field is still showing up in the bar graph.

As an aside, you wouldn't happen to be able to help explain section access/ have a sample qvw that uses it?

swuehl
MVP
MVP

Yeah, the PS field will probably still show up, but you see the details for the July 5th now, don't you?

Then please attach an updated file.

There is quite a nice document explaining section access in the docs section:

http://community.qlik.com/docs/DOC-1853

Not applicable
Author

Aha! It seems to keep showing up because theres a value I had hidden on the details tab for July 5th that is null. How can I prevent it from being in the bar graph?

swuehl
MVP
MVP

Not sure what your criterium to hide the record is, a NULL in TimeReportedActual for that date? You can consider only records that show a value in that field using something like

=count({<TimeReportedActual = {"*"}, Date = {">=$(=weekstart(today(),-1))<=$(=weekend(today(),-1))"},

Month=, Day=, Year=, Week=, Quarter=>} distinct(TechID))*40