@felyoubi If you want to create the same month column using DAX in the table editor, the column formula would be
Month Name = IF(MONTH(DateTable[Date]) = MONTH(TODAY()) && YEAR(DateTable[Date]) = YEAR(TODAY()), "Current Month", DateTable[Month])
And for the current day it would be
Day = IF(DateTable[Date] = TODAY(), "Today", DateTable[Date])
...assuming the prior existence of two columns called Date and Month obviously.
It's a good additions to have but in my case it is useful if you want to see how well you're performing historically month by month. If I need to see just the current month then I use a filter.
I appreciate the feedback
@greggyb hi is there any way thru which i can get last day,
in my data file last date is 10 june where as in date table its showing 18 july 2016.
Also Please let me know how can i make last day as a default day like i said 10 jun was the last date in my data table so how come i put it to default date.
we have current month, year ,week. function in power query but we dont have current day function.
is there any way to show both "Current Month" and the value of the month?
i want the default selection will be 'Last 4 weeks' but i want to let the user the option to select the last one week only,
in this way it's not available
You can do this using a DAX measure called LASTDATE, or you can do it in the Query Editor and create a table which will only have the MAX date. In order to do that your data type on your column has to be DATE, and then when you filter it will give you the option for the Earliest or Latest.
I created a variation of this that creates the table using the current date and the previous 365 days. Thanks to @greggyb for the original solution. This has been super helpful.
In the original code the source of the table is this:
= List.Dates( #date(2015,1,1) ,Duration.Days( #date(2016,12,31) - #date(2015,1,1) ) + 1 ,#duration(1,0,0,0) )
I used this code instead:
= List.Dates( DateTime.Date(Date.AddYears(DateTime.LocalNow(), -1)) ,365 ,#duration(1,0,0,0) )