Maybe I missed it but I'm attempting to create a dynamic 'Month' parameter based on a datetime field - but can't seem to get just the month! ? Am I missing something ?
here's my source DTTM date/time field -
In Manage Data > Edit [selected] Data Set > Data source
Just add 'calculated field':
truncDate('MM', date)
where MM returns the month portion of the date.
See manual of truncDate function
The only place in Quicksight that you can get just a month, e.g. "September" is on a date-based axis of a visual. To do so, click the dropdown arrow next to the field name in the fields list, select "Format: (date)" then "More Formatting Options..." then "Custom" and enter MMMM in the Custom format input box.
Quicksight menu selection as described
This will then show the full month name on the date axis in your visual. NB It will use the full month name on this visual for ALL time period "Aggregations" - e.g. if you change the visual to aggregate by Quarter, it will display the full name of the quarter's first month etc.
If you are talking about "Parameters" in the Quicksight analysis view then you can only create a "Datetime" formatted parameter and then only use the "Date picker" box format for this parameter in a control (+ filter).
If you use a calculated field in either data preparation or analysis view the only date functions do not allow full month names as an output, you can get the month number as an integer or one of the allowed date formats here:
https://docs.aws.amazon.com/quicksight/latest/user/data-source-limits.html#supported-date-formats
You'll need to hardcode the desired results using ifelse, min, and extract.
Extract will pull out the month as an integer. Quicksight has a desire to beginning summing integers, so we'll put MIN in place to prevent that.
ifelse(min(extract('MM',Date)) = 1,'January',min(extract('MM',Date)) = 2,'February',min(extract('MM',Date)) = 3,'March',min(extract('MM',Date)) = 4,'April',min(extract('MM',Date)) = 5,'May',min(extract('MM',Date)) = 6,'June',min(extract('MM',Date)) = 7,'July',min(extract('MM',Date)) = 8,'August',min(extract('MM',Date)) = 9,'September',min(extract('MM',Date)) = 10,'October',min(extract('MM',Date)) = 11,'November',min(extract('MM',Date)) = 12,'December','Error')
Also, I apologize if this misses the mark. I'm not able to see the screeshot you posted due to security controls here at the office.
You can use the extract function. Works like this:
event_timestamp Nov 9, 2021
extract('MM', event_timestamp)
11
You can add a calculated field using the extract function:
extract returns a specified portion of a date value. Requesting a time-related portion of a date that doesn't contain time information returns 0.
extract('MM', date_field)
Related
I would like to put in a basic toggle into a Google sheet.
Here is my reference table, It gets imported from another Google document so it's updated all the time.
I also have another google sheet that goes back to this lookup reference. It fills in the data if the date is less than today's date and matches the Date and the Source columns as a key.
I'd like to add another part in the Google sheet that says Include Today and you can type in the word "Yes"
If you type in Yes, I would like the yellow section, that uses the lookup_ref reference table, to include today's date, and otherwise include only days before today. In the example here, today is October 14, so if we type in "Yes" into this field, we need to have a value other than 0 for V15.
Okay, so you want to optionally include today's values in the formula. So you can conditionally add 1 day to today based on the value of "Include Today".
For example, if you add "Include Today" Yes/No value at cell "Z1", then you need to add IF(Z1="yes",1,0). So your formula can be
=IFERROR(IF(O15 < today() + IF(Z1="yes",1,0), vlookup(A15,lookup_ref,4,false), 0),0)
I'm new to Tableau. I am trying to make an inventory report which tells the user how much of certain product he/she should buy in advance.
Depending on the amount of days selected on the filter, the difference in days of the complete period should be calculated. For example: If the filtered dates are from 1/03/2021 to 09/03/2021, the result should be equal to 9. The formula I used is the following: date_difference = DATEDIFF("day",MIN(DATE([Fecha])), MAX(DATE([Fecha]))) + 1
The problem comes when I try to use the value given by such date filter. My next calculation should be:
calc = Quantity Inventory / (Units sold / date_difference). Both Quantity Inventory and Units sold are calculated fields in which I have no problem. However, instead of having a fixed value of 9, date_difference changes as shown in the image, giving me incorrect results for the desired calculation.
How can I make sure that the calculated field date_difference has the value of 9 on all rows?. Actually, if I add date_difference field by itself in a different Page it does show the proper value. The problem occurs when calculating calc and trying to add it to the table.
Note: Remember that the value of date_difference will change, depending on the range of time selected on the date filter
Thanks a lot in advance.
Step-1 Use this calculation for date_difference instead
DATEDIFF('day', {min(DATE([Fecha]))}, {max(DATE([Fecha]))}) +1
Step-2 Add Fecha filter to context, by right clicking it in filters shelf.
This will solve your problem. See the GIF
I have a column named Exercise and in this column there is year. IE: 2021
How could i say to my filter to filter on current year only? I do not want to input a fixed year...
Use may as a variable:
CurrentYear = Date.Year(DateTime.LocalNow())
I am editing a Webi report using SAP Business Objects BI4.
I have a report with a table in which I display a date formatted like this :
=FormatDate([Sales Date];"dd-MMM-yyyy")
Originally, Sales Date dimension has the format "mm/dd/yyyy".
I want to sort my table by this formatted date dimension in ascending order, so I just select my table > right click > select Sort and then I select the =FormatDate([Sales Date];"dd-MMM-yyyy") in ascending order.
My problem is that, the sorting behavior is incorrect as the result is as follows:
Sales Date
----------
01-AUG-2006
----------
01-JUL-2010
----------
02-FEB-2006
----------
03-AUG-2005
As you can see above, it seems that the sorting is only done by the "day" value and it completely ignores the "month" and "year".
My object is correctly defined as "Date" in the universe.
and the sorting is correctly done when I don't use the formatting "dd-MMM-yyyy" and keep the original format of Sales Date.
Any suggestions please?
Thanks!
The return data type of the FormatDate is a string. This is why the sorting will be out of order as it will sort the string value instead of the date value.
You have two options:
Format the date using a (custom) date format (In the Formatting section when you have the document in Edit mode). You'll need to use the RIA (Java applet) in order to define your own custom date format. Alternatively you can use one of the formats available. This will not change the data type but only the presentation, thus the sorting should be fine.
If you still want to use the FormatDate option, you could add the [Sales Date] in a second column, use it to sort your data and then hide the column.
I'm stuck with sorting and showing the correct date in Xpages.
It is saved in format "dd.MM.yyyy" and it's a string.
Now why it's a string and formated that way, is because my boss has special wishes. And when I want to sort it from the newest date to older it does something like this:
26.05.2015
24.06.2014
22.04.2015
21.04.2015
20.03.2014
It starts sorting by day.
Is there a way to make it sort it like it should?
I see that i can write a Computed value to Sort column in view column header for date. But i don't know how to even start.
Change the underlying Notes view to get your date column into right order.
Convert the date strings to real date values in views column formula. Assuming your field is called DateText then your formula would be
#Date(#ToNumber(#Right(DateText; 4));
#ToNumber(#Middle(DateText; 3; 2));
#ToNumber(#Left(DateText; 2)))
It would be easier to use just #ToTime(DateText) but this can fail depending on server's local settings. Your date string format would work for a server with German locale settings but not for US. That's why is my suggested solution "safer".
If the date time value doesn't solve your problem and you do not transform your date via #Text (as mentioned in the comments) then create another (hidden) column BEFORE your column that should be displayed. Make this a true date (from your item), sort it and unsort the column to display.
Otherwise use this formula in the newly created sorted column:
#Text(#Year(yourDate))+"-"+#Right("00"+#Text(#Month(yourDate));2)+"-"+#Right("00"+#Text(#Day(yourDate));2)