Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bhagi
Contributor II
Contributor II

How to Create filter or button in Qlik Sense

Hi            

I'm unable to reply to this post count in range.

I have to create a filter or button like below

Mon-Fri and  Sat   

So if the user selects  Mon-Fri it will display in KPIs or charts those related data

if the user select Sat it will display only sat data.

any suggestions?

       

Labels (3)
2 Solutions

Accepted Solutions
Almen
Creator II
Creator II

Hello,

create a variable name it e.g. vKPIValue, set it's value to 0.

 

Create a KPI object and write the following:

=IF($(vKPIValue)=0,
Count({<DayName={'Mon', 'Tue', 'Wed', 'Thu', 'Fri'}, Time={">=$(=Num(MakeTime(8,30,0)))<=$(=Num(MakeTime(20,0,0)))"}>}Date),
Count({<DayName={'Sat'}, Time={">=$(=Num(MakeTime(8,30,0)))<=$(=Num(MakeTime(13,30,0)))"}>}Date)
)

 

If you don't need the time restraint, simply remove it from the set analysis.

 

Create two buttons and give it the vKPIValue as the variable you want to change. 

Name it Mon-Fr and it's value 0 and the other Sat and it's value 1 for example.

View solution in original post

Almen
Creator II
Creator II

Sure. The table that contains our date value needs another field DayName. 

You can try in script:

 

if(Weekday(Date)='Sat', 'Sat', 
if(Match(Weekday(Date),'Mon','Tue','Wed','Thu','Fri')>0, 'Mon-Fri')) as DayName

 

View solution in original post

5 Replies
Almen
Creator II
Creator II

Hello,

create a variable name it e.g. vKPIValue, set it's value to 0.

 

Create a KPI object and write the following:

=IF($(vKPIValue)=0,
Count({<DayName={'Mon', 'Tue', 'Wed', 'Thu', 'Fri'}, Time={">=$(=Num(MakeTime(8,30,0)))<=$(=Num(MakeTime(20,0,0)))"}>}Date),
Count({<DayName={'Sat'}, Time={">=$(=Num(MakeTime(8,30,0)))<=$(=Num(MakeTime(13,30,0)))"}>}Date)
)

 

If you don't need the time restraint, simply remove it from the set analysis.

 

Create two buttons and give it the vKPIValue as the variable you want to change. 

Name it Mon-Fr and it's value 0 and the other Sat and it's value 1 for example.

bhagi
Contributor II
Contributor II
Author

Hi,

thanks for your response.

Instead of doing with set analysis. Can i do it in script create field values like

Mon-Fri

Sat

so that if user selects that data will display .

Almen
Creator II
Creator II

Sure. The table that contains our date value needs another field DayName. 

You can try in script:

 

if(Weekday(Date)='Sat', 'Sat', 
if(Match(Weekday(Date),'Mon','Tue','Wed','Thu','Fri')>0, 'Mon-Fri')) as DayName

 

EMaebe
Contributor III
Contributor III

How about the Pick Match formula? 

I asked a similar question yesterday here: Pick Match vs If Match: grouping a dimension

=Pick(Match(FieldName,'Mon','Tue','Wed','Thur','Fri','Sat'), 'Mon-Fri', 'Mon-Fri', 'Mon-Fri', 'Mon-Fri', 'Mon-Fri', 'Sat')

 

bhagi
Contributor II
Contributor II
Author

Thanks for your suggestions.