Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I have a table like this:
DateTime | Status | Tap_Id |
---|---|---|
01/01/2012 14:00 | open | 1 |
01/01/2012 15:00 | close | 1 |
02/01/2012 14:00 | open | 1 |
02/01/2012 4:30 | close | 1 |
02/01/2012 4:45 | open | 1 |
03/01/2012 20:00 | close | 1 |
03/01/2012 20:00 | open | 1 |
I want to build a simple chart that will present for each day and tap the last status - open or close (the biggest datetime for each day)
Thanks in advance.
Thank you all for helping me.
I didnt give up.... i will find a way to solve this with set analysis....
Pleas write the answer here when you find a way to do this with SA. I'm really interested to see that is this posible with use of SA or not.
Best Regards
Peyman
Hi, I've come to the conclusion that you cant achieve this with set analysis, the reason is below:
The reason is, that when you define a set in set analysis it defines the set as if you were making selections in all the data. It doesn''t take into account the dimension or divide up the data by dimension.
So if you include an expression in the set analysis, this is performed first over the full set of data before being applied to each element in the dimension.
so in the example above if you were to reference $(=max([chosen_field]) in the set analysis this would work out the max(chosen_field) for all the data before applying that static max to the dimension. So there is no immediately easy way to use set analysis differently dependant on what was in the dimension.
Hope this helps clarify things!
Erica
Dear Matan, I like the people that never gives up!!
In first place, with a table with "date" as dimention (if you don't have the "date" field, you could create with a calculated dimention like =Left(date(DateTime),10)), the expression that gives to you the last state is:
=FirstSortedValue(State, -DateTime)
But, for make this with SA, you need to tell to the expression witch values are available. These available values will be only the max for each day. The expression would be:
Only({<DateTime={$(vMaxTime)}>}Status)
Because of sintaxis of SA, you cant use search query inside another search query, and to make that you need to make a variable. In this case, it would be:
='"*'&Concat(left(Timestamp(Aggr(max(DateTime),date)),16),'","*')&'"'
This variable creates a search string, with the values of the max for each day. From inside to outside, Aggr(Max(DateTime), date) gives you the max values aggregated by date. Then, with TimeStamp, you transform it to a timestamp string. I used Left to pick out the seconds, because if you use the [Format] parameter of TimeStamp, you could give round problems, and have a difference of minutes, creating invalid timestamps. Note that if you have hours less than 10, you should use left(...., 15). I recomend that you format these field to HH:MM:SS, or HH:MM and don't use Left.
Then, the Concat creates the complete string with all the max values.
Im agree with you, IT IS POSSIBLE!!
matan... I taked time in response your question, and also explain you the solution, and you not even mark as answered?
Thanks a lot !!!
Somehow i knew it can be done.
Sorry for not comment earlier- i've been on vacation.
Did you know if this solution is easier to calculate then the firstsortedvalue formula ?
Thanks again for your effort
Its Ok Matan!! Did you went to any vacation place?
The solution with firstsortedvalue is most simply, but i don't know if it's faster to calculate...
You can try both and comment to us!