Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
thabo2g5
Contributor III
Contributor III

Dates

Hi Everyone

i have a datasource in that data i want to flag dates  where system are on peak ( between 24 & 4)  and off-peak ( between 5 & 23) so i want to flag them for every month . please help

thank you in advance

Labels (1)
1 Solution

Accepted Solutions
Anil_Babu_Samineni
MVP
MVP

Try this?

Load *,

If(Day(dates) >= 4 and Day(dates) <= 24, 'on peak', If(Day(dates) >= 5 and Day(dates) <= 23, 'off-peak')) as FieldName

Group By dates;

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

View solution in original post

6 Replies
Anil_Babu_Samineni
MVP
MVP

Try this?

Load *,

If(Day(dates) >= 4 and Day(dates) <= 24, 'on peak', If(Day(dates) >= 5 and Day(dates) <= 23, 'off-peak')) as FieldName

Group By dates;

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
Kushal_Chawda
MVP
MVP

Can you please elaborate?

tresB
Champion III
Champion III

Group By might not be required, right?

Anil_Babu_Samineni
MVP
MVP

May be, But the reason i state the Group By here is recently i've faced issue with Unique dates so then i thought to use..

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
tresB
Champion III
Champion III

But without any aggregation function 'group by' would throw error.

Anil_Babu_Samineni
MVP
MVP

Again true, I feel it like using Aggregation only. thanks your prompt

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