Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

am pm filter pane qlik sense

Hiya

how do you create a filter pane to just show AM  and PM option

Time([Order Date],'TT')

this works , but It creates loads of instances of AM and PM.

need to group by AM and PM.

I have done this in the data load too

Date(Floor([Order Date]))  as "Order Date",

please help

1 Solution

Accepted Solutions
quriouss
Creator III
Creator III

I think that AND should be an OR.  I don't think you're expecting an Order Date which is before 8am *and* after 5pm.

I'd think you want;

If(((Frac([Order Date]))>=(17/24) OR (Frac([Order Date]))<=(8/24)), 'PM', 'AM') as Night and Day

View solution in original post

8 Replies
joeybird
Creator III
Creator III
Author

Hiya

date and time is held in same field

tried this too but no joy

If((Time(Frac([Order Date]))>=Time('12:00:00') AND Time(Frac([OrderDate]))<=Time('00:00:00')), 'PM', 'AM')

Please help

jonathandienst
Partner - Champion III
Partner - Champion III

That's because Time() simply formats the value, the underlying value is not changed, so each distinct value will appear in the list box even though they look the same due to the formatting.

You need to create two distinct values, fort example:

     =If(Frac([Order Date]) >= 0.5, 'PM', 'AM')

Better still is to do this logic in the load scripts to create an AMPM field using the same logic.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
joeybird
Creator III
Creator III
Author

hi

I have tried this in the load as suggested

as need to define AM and PM times

If(((Frac([Order Date]))>=Time('17:00:00') AND (Frac([Order Date]))<=Time('08:00:00')), 'PM', 'AM') as Night and Day

I still only see AM

Please help

Not applicable

try (17/24) instead of Time('17:00:00') and (8/24) instead of Time('08:00:00')

as Frac([Order Date]) will return a number, rather than a time.

If(((Frac([Order Date]))>=(17/24) AND (Frac([Order Date]))<=(8/24)), 'PM', 'AM') as Night and Day

Not applicable

oops - my bad

If(((Frac([Order Date]))>=(17/24) OR (Frac([Order Date]))<=(8/24)), 'PM', 'AM') as Night and Day


although:


If(((Hour([Order Date]))>=17 OR (Hour([Order Date]))<=8), 'PM', 'AM') as Night and Day


would probably be easier to read

joeybird
Creator III
Creator III
Author

Hiya

=If(Frac([Order Date]) >= 17/12, 'PM', 'AM')

works fine for first part

if I add next time bracket frame

If(((Frac([Order Date]))>=(17/24) AND (Frac([Order Date]))<=(8/24)), 'PM', 'AM')

I can only see AM

Please help

quriouss
Creator III
Creator III

I think that AND should be an OR.  I don't think you're expecting an Order Date which is before 8am *and* after 5pm.

I'd think you want;

If(((Frac([Order Date]))>=(17/24) OR (Frac([Order Date]))<=(8/24)), 'PM', 'AM') as Night and Day

joeybird
Creator III
Creator III
Author

Hiya

thanks team, we have a result.

thanks for both your help as Andrews answer worked to get AM / PM in general too.

wish you could check multiple correct instances

Kind Regards