Forum Discussion
Timeline slicer default to previous day
- 10 years ago
dsilveira wrote:
Thanks Anonymous
For the moment I'm using your solution, but really I would like work with the timeline because in some moments I like check the sales in the last month or maybe the last year or last week (I would like see in other range of time, BUT I usually check "yesterday").
For that, I would like keep the timeline and its functionalities.
Then just keep the timeline as it is. If you usually check "yesterday", create a measure and put it in an individual visual constantly, then you don't have to check "yesterday" any more. You can check the sales in last week,month,year and it won't affect the "yesterday" visual.
A measure based on a calendar table from Anonymous would be like
Yesterday Measure = CALCULATE ( SUM ( yourTable[Column] ), FILTER ( ALL ( yourTable), RELATED ( DateTable[Day] ) = "yesterday" ) )
I hope you're using a date table. It makes these things much easier. Add a custom column to your date table:
Day = IF( DateTable[Date] = TODAY() - 1. "Yesterday", DateTable[Date] )
If you want to get fancy,
Day = IF( DateTable[Date] = TODAY() - 1. "Yesterday", IF( DateTable[Date] = TODAY(), "Today", DateTable[Date] ) )
Use that column in your slicer, select "Yesterday", and it will always hold onto yesterday as the default selection.
If you're not using a date table in your data model... use a date table.
- dsilveira10 years ago
Advocate I
Thanks Anonymous
For the moment I'm using your solution, but really I would like work with the timeline because in some moments I like check the sales in the last month or maybe the last year or last week (I would like see in other range of time, BUT I usually check "yesterday").
For that, I would like keep the timeline and its functionalities.
Some another idea, please...
Thanks!
- Eric_Zhang10 years ago
Microsoft Employee
dsilveira wrote:
Thanks Anonymous
For the moment I'm using your solution, but really I would like work with the timeline because in some moments I like check the sales in the last month or maybe the last year or last week (I would like see in other range of time, BUT I usually check "yesterday").
For that, I would like keep the timeline and its functionalities.
Then just keep the timeline as it is. If you usually check "yesterday", create a measure and put it in an individual visual constantly, then you don't have to check "yesterday" any more. You can check the sales in last week,month,year and it won't affect the "yesterday" visual.
A measure based on a calendar table from Anonymous would be like
Yesterday Measure = CALCULATE ( SUM ( yourTable[Column] ), FILTER ( ALL ( yourTable), RELATED ( DateTable[Day] ) = "yesterday" ) )
- shilpib9 years ago
Helper I
HI
When i am using it its giving
Day = IF(
datevalue('Date'[Date]) = TODAY() - 1;
"Yesterday"; VALUE('Date'[Date])
)Expressions that yield variant data-type cannot be used to define calculated columns.
how should i use it?
Regards
Shilpi
- Anonymous9 years agoNot applicable
shilpib you have two return clauses in that function that each return a different type of data. The word "Yesterday" is text and VALUE('Date'[Date]) explicitly casts the date as a date type. Both clauses must either return explicit text or a direct column reference that the function can re-cast as text on return. So take out the VALUE() function. See my original formula structure above.
- shilpib9 years ago
Helper I
Hi
yes i casted them to same datatype now but still i cant set yesterday as default value in timeslicer. Looks like we cant set any default date in time slicer .
- shzyincu9 years ago
Helper I
What do you mean by date table?