Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Tell us which business and trade publications you read most regularly: RESPOND NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
bhagi
Contributor II
Contributor II

Create filter or button

Hi            

im unable to reply in this post  https://community.qlik.com/t5/New-to-Qlik-Sense/count-in-range/m-p/1881572#M198610.

I have to create a filter or button like below

Mon-Fri    and  Sat   

so if user selects  Mon-Fri it will display in KPIS or charts  those related data

if user select on 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 II
Contributor II

How about Pick Match formula? 

I asked a similar question yesterday here

=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.