adding weekends and excluding working days [closed] - tableau-api

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How can I create a calculated field in Tableau that shows me the following;
it should exclude weekdays working hours between 08:00 am-16:00pm
It should include full weekends.
Trying to find who is login to the system after working hours.
Thanks a lot,

Assuming that you want to flag unauthorised logins, I have done it like that-
Sample data I have used-
Calculated field unauth_login like this
DATEPART('iso-weekday', [Login_time]) >5
OR
DATEPART('hour', [Login_time])>=16
OR
DATEPART('hour', [Login_time])<8
and you will your desired results with yes values flagged separately from no. Screenshot
Do tell me whether I got you correct?
Assumption: Saturday and Sunday are weekends are in your country/locale.

Related

What is the solution for 'For fetch only' in postgresql? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have one query in DB2 which use 'for fetch only' but I need to convert it into postgresql. What can we use it for that?
You don't need that in PostgreSQL. In PostgreSQL, any cursor can be used for a positioned UPDATE or DELETE.
Just omit the clause in PostgreSQL.

how to check is string contains substring? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a table with field name out of type text
I want to get the rows which contains sub string "hello and good morning"
I have tried to write:
select *
from my_table
where out like 'hello and good morning%'
but it seems not working.
How can I get all the rows which contains sub string ?
According to given details, this should work.
select * from my_table where LOWER(out) like LOWER('%hello and good morning%')
Here is the fiddle.

newline character in Postgresql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
How can we get this output
results from query should be like:
Assessment
penalty
both values are coming from two different columns. I want to join these two columns but want results like above in single cell. so there should be new line for second column(but in same cell)
select assessment || E'\n' || penalty from wherever
or
select concat_ws(chr(10), assessment, penalty) from wherever
Note: I am assuming, since you didn't say, that neither column can be null.

Save a ordering list of data into core data [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
i have an nstableview, where the user can add rows.
each row will directly save into Core data.
at the moment i can request the records of core data and sort it by objects id to get the correct order, because the object id is nearly the same like an incremental number.
but now the user can reorder the rows.
how can i save this new order of rows into core data?
Using the id as a way to order is not guaranteed to work, so you shouldn't do that.
Instead, add a field that represents the order.
What we do is have a field called pos that is in integer and we set it sparsely. The first record can be 100, the second 200, etc. Then when we re-order, we set pos to the mid-point of the records right before and after. Every once in a while, you need to re-number the records. The more sparse you do it, the less you need to re-number.
When you add a new record set it to the max value + 100 (or whatever spacing you are using)

Postgres: how can I subtract value at one query? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I think I can only get value, subtract value (at Java) and update value. Is it possible to subtract value at cell at one query?
Yes, but you got the syntax a bit wrong:
UPDATE table SET number_of_people = number_of_people - 3 WHERE id = 487364
This assumes that number_of_people is an integer value.