Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
mp802377
Creator II
Creator II

Would Like User to Select the Day of the Week they want the Chart to view.

I created this before, and it worked. But the other app was a bit different.  In the original app, I created an Inline Table _DayOfWeek (see below). Then I created a list box of the field DayOfWeek (pulling from Inline Table).  For the straight table chart, I just had one expression, and that was =Date(WeekStart(TransDate, 0, DayOfWeekID),'DD-MMM-YY') . And it worked, beautifully. 

The new app, they want the same feature. They want the ability to select what day of the week they want the chart to start. The problem is, they want the charts dimensions to show the [Trans Date] & [Trans Hour]. The Hour is a text so I used the Dual command. Here are the two dimensions I thought would work.

They are

 =Dual( Weekday([Trans Date])&' '&num([Trans Hour],'00')&':00' , Weekday([Trans Date], DayOfWeekID ) + [Trans Hour]/24 )

=Date(WeekStart([Trans Date], 0, DayOfWeekID), 'DD-MMM-YY').

I have attached an image of the chart. You can see the legend is pulling in the correct day of the week, but the dimension in the chart shows Monday and Sunday. When I had the expression =Date(WeekStart([Trans Date], 0, 6), 'DD-MMM-YY'), it reflected the entire week, but Sunday thru Monday.

Inline Table:

_DayOfWeek:
Load * Inline [
DayOfWeekID, DayOfWeek
0,0 - Monday
1,1 - Tuesday
2,2 - Wednesday
3,3 - Thursday
4,4 - Friday
5,5 - Saturday
6,6 - Sunday

]
;

 

Chart:

mp802377_0-1698168679954.png

 

Labels (1)
1 Solution

Accepted Solutions
mp802377
Creator II
Creator II
Author

I found a solution. In case this is something someone else might need, here is the solution. Not the one I was hoping for (I wanted the end user to select a drop down list and not use buttons).

First, I created a variable called vWeekDay. I defaulted to 0. Then I created buttons, one for each option. Each button had a trigger to set the variable vWeekDay. For example, the Sunday - Saturday button set the trigger to 6, Monday - Sunday, set the trigger to 0 and so on. I put a example of the chart below. Each button works. 

Used Dimensions

=Dual( Weekday([Trans Date])&' '&num([Trans Hour],'00')&':00' , Weekday([Trans Date], $(vWeekDay) ) + [Trans Hour]/24 )  // Label name: Day / Hour

=Date(WeekStart([Trans Date], 0, $(vWeekDay)), 'DD-MMM-YY')  // Label name: Week

 

This is the chart, looks how I wanted it to. When I did the buttons, I set them so the color is lighter when selected so the end user knows what they pressed. Candy cane color is for current week.

mp802377_1-1698182916550.png

 

 

View solution in original post

1 Reply
mp802377
Creator II
Creator II
Author

I found a solution. In case this is something someone else might need, here is the solution. Not the one I was hoping for (I wanted the end user to select a drop down list and not use buttons).

First, I created a variable called vWeekDay. I defaulted to 0. Then I created buttons, one for each option. Each button had a trigger to set the variable vWeekDay. For example, the Sunday - Saturday button set the trigger to 6, Monday - Sunday, set the trigger to 0 and so on. I put a example of the chart below. Each button works. 

Used Dimensions

=Dual( Weekday([Trans Date])&' '&num([Trans Hour],'00')&':00' , Weekday([Trans Date], $(vWeekDay) ) + [Trans Hour]/24 )  // Label name: Day / Hour

=Date(WeekStart([Trans Date], 0, $(vWeekDay)), 'DD-MMM-YY')  // Label name: Week

 

This is the chart, looks how I wanted it to. When I did the buttons, I set them so the color is lighter when selected so the end user knows what they pressed. Candy cane color is for current week.

mp802377_1-1698182916550.png