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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
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

try it
stekol61
Creator
Creator
Author

How should the syntax look like?

I also tried this expression and it gives the correct result as long that you select the current week in the filter.
If ($(vDim)=(CurrentWeek),Count(wor_ticket_ID),)

Shubham_Deshmukh
Specialist
Specialist

TO AVOID FILTERS only the list box field is enough, in your case

Year(wor_event_start_date)&'-'& Week (wor_event_start_date) as Week , why u are using vDim in list box then? 

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

stekol61
Creator
Creator
Author

The use of  vDim is to be able to present and select Week or Month in my app. I followed this instruction when created it:

https://community.qlik.com/t5/Qlik-Sense-App-Development/Switching-between-2-different-time-dimensio...

I want to avoid/exclude all filter in one single textbox, it should only present data for current week. All other graphs should use the week/month filter

 

Shubham_Deshmukh
Specialist
Specialist

Can you create another data island with ID, date?
That island will not have any connection with existing data island and you can simply have current week data, it becomes simpler than this

stekol61
Creator
Creator
Author

I created a new app with this data:

FACT_1:

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

(Year(Today()) &'-'& Week(Today())) as CurrentWeek,
(Year(Today()) &'-'& Month(Today())) as CurrentMonth,

wor_ticket_ID,
wor_country

FROM

However, the result is not OK. The table with 'Current week,  'Country' and 'Count(Ticket)' shows he result for all data loaded . The other table with 'Week' also shows data for all data loaded , but for the correct 'Week' (2019-9) the result is OK

speed.PNG

Shubham_Deshmukh
Specialist
Specialist

You are making it complex unnecessarily.

I said just load ID and date, 

LOAD wor_ticket_ID  as alias1, wor_event_start_date as alias2 from table;

**NOTE : Use alias names for  wor_ticket_ID   and wor_event_start_date , as we are creating data island

Now in text box put this only, it will not get affected by other filter as it is different data island,

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

stekol61
Creator
Creator
Author

OK.
But it would be good to test in a new app so verify that it works.
Should the expression relay contain 'weekStart(today()))<=$(=weekEnd(today())' instead of e.g. 'CurrentWeek'?
stekol61
Creator
Creator
Author

I tested your expression in the new app and it gave the same result as earlier, 'result for all data loaded'
Shubham_Deshmukh
Specialist
Specialist

See my sample data and exp, it is giving me correct result for current week(25Feb -03Mar) ,er3.png

er2.pnger.png