I have some Expression to get date UTC+7 (Jakarta time) like this
toDate(toString((currentUTC()+ hours(7))),'yyyy-MM-dd HH:mm:ss')
and for example output is:
2021-12-28 20:15:23
I want from this expression is add day -1, and the output is:
2021-12-27 20:15:23
many big thanks for answer the question
You could try the below :
addDays(toDate(toString((currentUTC()+ hours(7))),'yyyy-MM-dd HH:mm:ss'),-1)
Related
I have to table, start and end with time as the data, I want to calculate the total hour from start to end.
I tried this but it does not return hour, it returns date and the date also same in the column:
Column = SUM('Data'[Finish Date])-SUM('Data'[Start Date])*24-12
Anyone can give me idea please. Thank you so much
Read the docs: https://learn.microsoft.com/en-us/dax/datediff-function-dax
Column = DATEDIFF('Data'[Start Date], 'Data'[Finish Date], HOUR)
The image is the format of my Date Timestamp on gSpreadsheet. I have tried to sort it from earliest to latest date timestamp but it is not sorting well. Is there any ways to help me in this? Thank you, appreciate it.
try:
=SORT(A2:A; INDEX(SPLIT(A2:A; ",");;1); 0; INDEX(SPLIT(A2:A; " ");;2), 0)
where you can change 0 (desc) to 1 (asc)
Note!
You are using an invalid date format, time date should be a number and formated as date like so
To sort as is:
Use this formula
=QUERY(SORT({ A2:A, IF(A2:A="",,ArrayFormula(INDEX(ArrayFormula(SPLIT(SUBSTITUTE(A2:A,"GMT",""), ",")),,1)+INDEX(ArrayFormula(SPLIT(SUBSTITUTE(A2:A,"GMT",""), ",")),,2)))}, 2,1), " Select Col1 ")
Hi I am trying to parse the following string in hive
"2016-09-30T21:59:58.093Z"
I would like to extract the year, month, day and hour from it.
I can use the year(), day() and to_date() function to extract up to the day, but I can't get the hour from it. If I do
hour("2016-09-30T21:59:58.093Z")
or
unix_timestamp("2016-09-30T21:59:58.093Z")
they will return NULL. Can someone suggest something?
thank you
hive> select from_unixtime(unix_timestamp("2016-09-30T21:59:58.093Z","yyyy-MM-dd'T'HH"),"yyyy-MM-dd HH");
OK
2016-09-30 21
You can use translate("2016-09-30T21:59:58.093Z", "T"," ") for the output
this is my dataset:
I want to calculate the "Cover Month". Therefore I have to look for Stock(in this example in january 2016 = 5,000), then have a look for each future month if current stock(january 2016) is bigger than "cum. Sales" of following month. If yes, then remember value = 1. This should be done for each future month. After this step all remembered values should be added, so result is 4 (Cover Month). Stock will be enough for 4 following months.
Next step system should do this for next month - dynamically for each month...
How can I do this in a performant way?
Is this the right way:
Filter([TIME].[Year to Month].currentmember : NULL,
[Measures].[cum Sales] < [Measures].[Stock])
?
Maybe anybody can give me a hint? Or maybe I need another alternative formula to get a subtotal and then do another calculation?
Thanks in advance, Andy
If you just require a 1 or 0 then can things not be simplified:
IIF(
SUM(
{[TIME].[Year to Month].currentmember : NULL},
[Measures].[cum Sales]
)
< ([Measures].[Stock],[TIME].[Year to Month].&[Jan-2016]) //<<amend to the date format used in your cube
,1
,NULL
)
I am currently working with reports in Navision by a "book sales" currently use 2 variables "Date" one for the start and one for the end of the filter, but I wonder if you can only use a single variable where the user directly enter "month" and "year". Thank You!
If you are setting the filter with SETRANGE you need two values. But if you use SETFILTER you can use a string with a date filter like this:
010115..103115
p1..p3
and the just:
DateField.SETFILTER(filterstring);
Yes, when the user put the month and year data you by code transform this info in date values example:
Variables from and to = date
from := DMY2DATE(1, Month, Year);
EVALUATE(to, FORMAT(CALCDATE('+1M', Desde) -1));
YourTable.SETRANGE("Posting Date", from, to);