Reply
Super Contributor
Posts: 1,152
Registered: ‎12-29-2015

Re: Setting the Default Value of a Slicer

[ Edited ]

@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.

Regular Visitor
Posts: 25
Registered: ‎04-12-2016

Re: Setting the Default Value of a Slicer

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

Super Contributor
Posts: 1,152
Registered: ‎12-29-2015

Re: Setting the Default Value of a Slicer

@felyoubi were you not asking for the equivalent DAX formula then? Your previous post was oddly worded so I'm not sure what you were asking for.

Regular Visitor
Posts: 25
Registered: ‎04-12-2016

Re: Setting the Default Value of a Slicer

Haha, Thanks

I forgot to add the link. Post updated and I do appreciate your feedback Smiley Happy

 

-Fahd

Regular Visitor
Posts: 24
Registered: ‎05-24-2016

Re: Setting the Default Value of a Slicer

@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.

Member
Posts: 329
Registered: ‎03-29-2016

Re: Setting the Default Value of a Slicer

@greggyb

hi!

 

great idea!

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

 

thanks!

Member
Posts: 83
Registered: ‎03-17-2016

Re: Setting the Default Value of a Slicer

Thanks @KHorseman and all for your help;

 

I was able to use this to fix my issues.

 

Thanks;

Andrew

Member
Posts: 56
Registered: ‎05-04-2016

Re: Setting the Default Value of a Slicer

Is there a way to tweak this to show most recent date?

We have a dashboard that is warehoused weekly.

Highlighted
Super Contributor
Posts: 1,503
Registered: ‎06-24-2015

Re: Setting the Default Value of a Slicer

Hi @FrugalEconomist

 

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.

Visitor
Posts: 1
Registered: ‎04-19-2017

Re: Setting the Default Value of a Slicer

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) )