Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
DaJu
Contributor
Contributor

Search for a period of time and how can i define a period of time the right way

Hello community,

I run in a problem and i am not sure if this is even possible in QLike Sense.

 

I would like to get all broken PCs which had a defect in a period of time. And save that data in a variable to use it later in other expressions or if it is possible select only this data (simular when you would select them by hand but with an expression).

This is what i got so far:

=if(GetSelectedCount([PCSystem]) > 0,
if( Date#([OutOfOrderDate] , 'YYYY-MM-DD') < Date#(AddMonths(SelectedDate, 1 , 1), 'YYYY-MM-DD')
AND
Date#([OutOfOrderDate] , 'YYYY-MM-DD') > Date#(AddMonths(SelectedDate, -1 , 1), 'YYYY-MM-DD'),
>-- Here save Dates which are in the timespan or use an expression to set the selection --< , 'No Data'
),
'Too many Data')

If i did not described it so it is easy understandable please ask me which part is unclear so that i can solve that misunderstanding.

 

I am very thankfull for every good answer.

 

Labels (3)
2 Replies
lorenzoconforti
Specialist II
Specialist II

I don't believe it's possible as you need to initiate an action to modify a state

What you can do, you can define a variable that provides a set expression that you can then use in your measure; something like the below

=if(GetSelectedCount([PCSystem]) > 0, '{<OutOfOrderDate = {"<=$(AddMonths(SelectedDate, 1 , 1)>=$(AddMonths(SelectedDate, -1 , 1)"}>}','')

This is just to give you an idea as it looks like you also have some formatting challenges

If you post your qvf it will be easier to help you

DaJu
Contributor
Contributor
Author

Thank you for your answer. Sorry that i replay such late but i was on vacation ^^. I will try to use your sugesstion maybe i can get with it closer to the goal.

I try to create an example App which i can post here (because there are some sensetive data in the current app).