Start of the month and end of the month filter - apache-superset

I want to apply a filter which should start from every month 01 00:00:01 to next month 01 00:00:01, how this can be achieved using apache superset advanced filter or any other means,
Superset version I am using is 2.0.0
I have tried Date_trunc, dateadd, datetime etc, none of them are supporting

Related

Date Filtering for Active rows based on begin and end date

Good Afternoon,
For a project I need a method to show with a year filter which rows were active in that year based on a start and an end date.
Example dates:
25th Oct 2019 - 14th Jul 2022
1st Feb 2020 - 1st Jan 2022
25th May 2016 - 24th May 2018
With A filter on 2020 this would mean:
Show
Show
Don't show
I have an approach that works but it only works if you enter a specific date as a filter. My measure works like this:
I have a separate datetable that I use as a filter, this value is stored in the variable selDate, and the isActive variable checks whether this variable date falls in between.
My DAX code:
Find_active_row =
var selDate = SELECTEDVALUE(Dates[Date])
var isActive if(and(selDate>=firstdate(Table[Startdate]),selDate<=firstdate(Table[enddate])),1,0)
return isActive
So my problem is I want to filter by year and now I need to filter a specific day for it to work. I'm actually looking for a replacement for firstdate because this doesn't work if I make Table[Startdate].year because it won't be a date field anymore. I hope my problem is clear and any help is appreciated :)

Relative date filter on calendar week not calculating last date of the latest week correctly

I have date dimension table and sales fact table.
Created a chart visual with date week on x axis and values as sum of salesamt.
In the filter pane added relative filter to the date. In the last 4 calendar weeks.
I have a measure that shows LASTDATE(DateTable[Date]) also on the report.
The last date is showing as 6 Feb 2021 (Saturday)
Same value when I select the latest week on x axis.
However when I choose any prior week on x axis, then the last date value is Sunday 31 Jan 2021.
Why does the current week last date show as 6th Jan 2021 (saturday) instead of 7th Jan 2021 (sunday)?
Currently, calendar week is defined Sunday to Saturday when it comes to filtering using relative dates. You can work around it by introducing additional column (basically date - 1 day) and set your relative filter on that.

How to filter YTD to last complete month in Power BI

I am creating a report with buttons that use a slicer to show the last 3 calendar months, the default view, and YTD. The first two are all set and will continue to work fine, however i am having trouble with the YTD filter because i need it to exclude the current month (some of the key metrics for this slicer are only accurate monthly, even thought the data is updated Daily). Any idea how to accomplish this without me having to manually change it every month? An example of it working today would show me 2020 through August, since September is not complete. September would be included in the filter starting October first. I am thankful for your help/insights!
I typically build a calculated column on my date table called something like "Date in Range", that looks something like the below. You could also apply this to a date in a normal table if you are not using a date dimension.
Date in Range = IF ('MyTable'[Date] <
DATEADD(TODAY(), -1 * DAY(TODAY()), day),
1,
0)
This compares the date in the table row with TODAY(), e.g. 14 Sep 2020, minus the day of the month of today (14), effectively getting you back to the start of the current month. This will then return 1 for dates before the end of last month or 0. Filter on 1 or 0 to get your result (or use something more meaningful in place of the 1 or 0).

Start week on monday in AWS Quicksight

I know I can change the date field granularity to week in AWS Quicksight, and I can also display the date by week number. But as far as I understand, Quicksight defines the start of a week on Sunday, and I need it to be Monday.
Is there any way to start the week on Monday in AWS Quicksight?
Here is a formula for a calculated field you can add that will group your dates by weeks starting on Mondays. You should be able just replace {date_date} with your field name and copy/paste this into the formula box (including the newlines) and it will do the trick.
addDateTime(
1,
'DD',
truncDate(
'WK',
ifelse(
extract(
'WD',
{date_date}
) = 1,
addDateTime(
-1,
'DD',
{date_date}
),
{date_date}
)
)
)
This field will equal the Monday that starts the week your date falls into.
You can put this all in one line but I added the line breaks for readability.
It essentials checks if the date is on a Sunday, and moves it to the previous week and then just adds a day to the normal trunc function so that the weeks begin on Monday.
Acoording to the documentation
https://docs.aws.amazon.com/quicksight/latest/user/truncDate-function.html
WK: This returns the week portion of the date. The week starts on Sunday in Amazon QuickSight.
you can use filters to start like here
This is still an issue when using filters and rolling dates as weeks in analytics.
There is an open thread in the AWS community forum.
https://community.amazonquicksight.com/t/starting-weeks-on-monday-show-gaps-on-custom-weekly-groupings/4222
As a I workaround for this, I would recommend defining a column (either in the dataset or as a calculated field) that represents the year_week_iso (ie. 2023-W01 or 202301 if you prefer to have an integer value).
This column can then be used to group data in order to show trends over time when the week begins on a Monday.
The integer version of this column can also be leveraged to show the most current week of data by setting up a Top 1 filter that is based off the max(year_week_iso_integer) →
example Amazon Quicksight filter to get current week

How to MTD, YTD in Apache Superset?

I would like to create a dashboard with month to date (MTD) and year to date (YTD) charts. However, I do not want to update my date range each month. A fixed date range would do this. Choosing 1 months ago give the last 30days. Using last month gives me last month and everything from this month. Yet, this month is not supported. MTD doesn't work either. I am using Superset version 0.24.0
I figured it out! Use 1st for MTD and Jan 1st for YTD.
For newer versions of Superset, this quarter is supported for quarter to date (QTD) charts.
I think it can be set on the custom tab of the time range in the chart explorer. There you can use 1st and Jan 1st as strings that are parsed.
TO get MTD put 1st in the 'Start' field and put this month in the 'end' field
Select Range Type as "Advanced", then enter "1st" for Start Date and leave End Date blank. Image has today's date as End Date but leave it blank to get YTD
TIME RANGE dialog showing YTD entries