Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dsilveira
Advocate I
Advocate I

Timeline slicer default to previous day

Hi everyone!
I have a timeline that allow to show me all my sales since 2002 day to day, but the most important day for me is "Yesterday" I would like show by default this value in my timeline. (To select that day ("yesterday") in all these day is tricky because it is at the end of the list). Or maybe the solution is order the timeline desc, and in this case "yesterday" is at the begining of the list.

 

Thanks in advance

1 ACCEPTED SOLUTION


@dsilveira wrote:

Thanks @KHorseman

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 @KHorseman would be like

 

Yesterday Measure =
CALCULATE (
    SUM ( yourTable[Column] ),
    FILTER ( ALL ( yourTable), RELATED ( DateTable[Day] ) = "yesterday" )
)

 

View solution in original post

12 REPLIES 12
shilpib
Helper I
Helper I

Hi

 

Could not really figure out how it was implemented.

I have a timeslicer with date field and i want to make yesterday as default. I am using dircet query , can you helpme how to fix this.

I dont have datecalendar .

 

Regards

SHilpi

KHorseman
Community Champion
Community Champion

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.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




What do you mean by date table?

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

 

 

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





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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 .

 

 

If you're talking about the timeline custom visual I think that requires dates, not text. The "Yesterday" text method only works if you're using a standard slicer.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I solved it by creating an extra slicer and getting 2 valyes there 1) yesterday and 2) all and set it to yetserday as default.

How you have set the default value?

Hello all;

 

I had created the new Yesterday slicer and it seems to work. However, I want to incorporate this into the Date slicer as well so that i can default it to Yesterday or select a range of days if needed. Is there a way that we can do this? Below are the two slicers that i really want to combine into one slicer only. Otherwise, i have to turn Yesterday to 0 and then select a range of days from the Date slicer. 

 

Date Slicer Question.jpg

Thanks in advance for your help.

Andrew

Thanks @KHorseman

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!


@dsilveira wrote:

Thanks @KHorseman

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 @KHorseman would be like

 

Yesterday Measure =
CALCULATE (
    SUM ( yourTable[Column] ),
    FILTER ( ALL ( yourTable), RELATED ( DateTable[Day] ) = "yesterday" )
)

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.