Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
pashok75
Contributor II
Contributor II

Weekday wise Production in Expression

Dears,

I have an requirement to take the weekly sales by day. Only the current week. Currently it is adding all the production data and sum it up by day.

I need to know only the week day trend for the current week wherein the week in need to have filters for the user to select.

For e.g.

Week1, Week 2, Week 3, Week 4

Lets say the Production for the week 1 is 10,000, week 2 is 20,000, week3 is 10,000 & week 4 is 10,000. There is a field we pull from the DB as day and we try to sum it up.

As per the attachment Qlik is summing up all the premium and present it day wise. I need to filter records only based on the current week by selecting week1, week 2, week 3 & week 4.

The Expression Field is SUM(T_NETPREM)

The Dimension Field is T_WEEKDAY

26 Replies
pashok75
Contributor II
Contributor II
Author

I have a field as T_APPR_DT and its the actual date.

Shall we use this column to get the weekday

Ashok

pashok75
Contributor II
Contributor II
Author

Its not working. It filters the max production date and not showing the current week trend.

Ashok

Anil_Babu_Samineni

Off course, Using WeekDay(T_APPR_DT) as WeekDay can convert into WeekDays. But to get recent Week you need to convert as Week(T_APPR_DT) as Week

Best Anil, 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
pashok75
Contributor II
Contributor II
Author

This line i added in the data extraction Load script.


WeekDay(T_APPR_DT) as WeekDay


Do I need to use the other script Week(T_APPR_DT) as Week in the Expression column. As when I add this in the load script the field is not coming to add it.



Anil_Babu_Samineni

Yes,

Load T_APPR_DT, //Assume, This is Date Field

         Week(T_APPR_DT) as Week,

         WeekDay(T_APPR_DT) as WeekDay,

         T_NETPREM

From Source;

And then, In front end use your Dimension needed as business for show case

Expression is

Sum({<T_WEEKDAY = {$(Max(T_WEEKDAY))}>} T_NETPREM)

Best Anil, 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
pashok75
Contributor II
Contributor II
Author

The script should be like this right as per your statement

Sum({<WeekDay = {$(Max(WeekDay))}>} T_NETPREM)

Anil_Babu_Samineni

I think Weekday should change into Week

Sum({<Week = {$(=Max(Week))}>} T_NETPREM)

Best Anil, 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
pashok75
Contributor II
Contributor II
Author

This statement sums all production. Lets say I have data from 1st November till 23rd November it is summing all the production values and present it week day wise.

My requirement is to only show the current week data alone. In this case the 3rd week.

Ashok

Anil_Babu_Samineni

From here if we use Week() as Week it converts into 1,2,3. and then i am using Max(Week) that means 3 only, i believe

Best Anil, 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
shraddha_g
Partner - Master III
Partner - Master III

Why don't you try out with WeekStart date then.

In Data model Create,

WeekStart(DateField) as WeekStart

And in Expression, you can use

Sum({<WeekStart = {"$(=Max(WeekStart))"}>} T_NETPREM)