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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
stekol61
Creator
Creator

Show data for current week

Hi!

I have an app where i want to  show the number of Tickets for the current week no matter what other date filters that are used in the app.

E.g. the date filter could be set for the previous 3 months and the result is presented in a graph but I also want to present the value for the current week

 

35 Replies
Shubham_Deshmukh
Specialist
Specialist

Stekol61,

**Note : filterToAvoid = use fieldName which you want to avoid, fieldToAvoid is not keyword.
And that solution is according to dates not according to week or month.
So it could be like,
=Count({<filterToAvoid=,yourDateFields={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)

**yourDateFields = from which you are getting month /week.

Also if you want to show current week only then you don't need any filter value just go with today(), it will give you current week.

stekol61
Creator
Creator
Author

I tried this:

=Count({<filterToAvoid=,Period={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)

It does not override the 'Period' filter (e.g  selecting week '2019-6' with 'Period' filter shows the result for that week , not the current week).

 

I also tried your suggestion "don't need any filter value just go with today()" but I get no result. Is the syntax correct?

=Count(Year(Today()) &'-'& Week(Today()) wor_ticket_ID)

Shubham_Deshmukh
Specialist
Specialist

It is showing you result for selected week because you are using filterToAvoid word, I am saying it should be field. As you wanna avoid Period,
=Count({<Period=,yourDateField={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)
**yourDateField = should be date field, not Period

=Count(Year(Today()) &'-'& Week(Today()) wor_ticket_ID) - not at all, what you are trying to do with this
stekol61
Creator
Creator
Author

This gives no result. The expression used for 'Period' is a variable '$(vDim'
=Count({<Period=,[$(vDim)]={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)

I tried to follow you second recommendation ("don't need any filter value just go with today()" ) and created this.
=Count(Year(Today()) &'-'& Week(Today()) wor_ticket_ID)
('Today()) &'-'& Week(Today()' gives the correct week format, e.g. '2019-9')
Shubham_Deshmukh
Specialist
Specialist

I think, miscommunication is going on here. Please state your exact requirement with date field

Try : sum (wor_ticket_ID), not count(wor_ticket_ID)
stekol61
Creator
Creator
Author

OK. Hope this clarify things:
What I need is to present number of tickets 'count(wor_ticket_ID)' for the current week no matter what time period is selected. The result can be presented in e.g. a text box.
The select time period should work for all other graphs in the app
Shubham_Deshmukh
Specialist
Specialist

Great, our discussion was on right track then,
=Count({<Period=,[$(vDim)]={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)
Now above exp will avoid Period selection and give you the result.
this will work, but what is in variable [$(vDim)]?
stekol61
Creator
Creator
Author

Your expression returns '0'.

$(vDim) is created like this:
Dims:
LOAD
Dim,
RowNo() as DimSort
INLINE [
Dim
Week,
Month
];

FACT:
LOAD
Year(wor_event_start_date)&'-'& Week (wor_event_start_date)as Week,
Year(wor_event_start_date)&'-'& Month (wor_event_start_date)as Month,

Also a variable is created:
vDim=minstring({<DimSort={$(vMinDimSort)}>}Dim)
Shubham_Deshmukh
Specialist
Specialist

I was asking for this date wor_event_start_date, try this now

=Count({<Period=,wor_event_start_date={">=$(=weekStart(today()))<=$(=weekEnd(today()))"}>} wor_ticket_ID)

stekol61
Creator
Creator
Author

It still follows the the time Period selection.
Maybe also the filer for 'Week' or 'Month' must be included. 'Dim' from the Dims table