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

October 28 & 29: Experts share their secrets on how to pass the Fabric Analytics Engineer certification exam—live. Learn more

Reply
Anonymous
Not applicable

Default Date

I have Calculated Dates filter and slicers and It is perfectly working fine.

I even added a TODAY filter that only filters based on today's data.

 

But the problem is that whenever i open the report it keeps the same dates as before (the slices doesnt get updated based on todays date).

 

I want the to set the default dates for the slicer to be for today whenever the dashboard opens.

 

for example:

If the report opens today, then FromDate in the slicer is 1-Jan-2021 & ToDate is 16-Feb-2021

If the dashboard viewed tomorrow then FromDate in the slicer is 1-Jan-2021 & ToDate is 17-Feb-2021.

2 ACCEPTED SOLUTIONS
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Dynamically show today's value by default by slicer is not supported in power bi.

In addition to  

Measure = IF(MAX('Table'[Date])>= DATE(YEAR(TODAY()),01,01) && MAX('Table'[Date])<=TODAY(),1,0)

Set this filter to show items when value =1.

1.png

However if you use this measure filter in your visual, it won't show values after today or before start day.

I update a new measure, build a date table for slicer.

Measure1 = 
VAR _MINDate = MIN('Date'[Date])
VAR _MAXDate = MAX('Date'[Date])
Return
IF(MAX('Table'[Date])>=_MINDate && MAX('Table'[Date])<=IF(_MAXDate>=TODAY(),_MAXDate,TODAY()),1,0)

By this measure it will show dynamic result by slicer.

1.png

If we change slicer from 2020/12/01 to 2021/02/19, it will show result we want.

3.png

Due to you use Between in slicer, this measure has a disadvantage that if the maxdate in slicer >Today when you open your report, it will show you values in maxdate instead of today. 

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

TWorku
Frequent Visitor

I had same issue. This is what I did if it helps.

 

I added calcuated column 

Is-Today = IF(MyDateTable[Date] <= TODAY(), "True", "False"). 
 
then i filtered as follows
 
TWorku_0-1619815572332.png

It works perfectly fine for me.

 
 

View solution in original post

6 REPLIES 6
TWorku
Frequent Visitor

I had same issue. This is what I did if it helps.

 

I added calcuated column 

Is-Today = IF(MyDateTable[Date] <= TODAY(), "True", "False"). 
 
then i filtered as follows
 
TWorku_0-1619815572332.png

It works perfectly fine for me.

 
 
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

Hi Rico,

          Actually I tried making the measure but it does not show me the todays date and the other dates as Zero and One,It just gives me One. Could You post me the Pbix as Mine is connected to Server And U cannot acccess it.

 

Regards

KAvSar

HI Richu,

           Thanks for your reply , I still did not try it in my file ,But thanks a lot for posting a reply, I think this will work as it is quite different from watevever I tried till Now, But I also would like to share the file with you

 https://we.tl/t-hLCNQxYm7g.

 

If possible take a look at it.

 

Thanks in Advance

KavSar

v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

Dynamically show today's value by default by slicer is not supported in power bi.

In addition to  

Measure = IF(MAX('Table'[Date])>= DATE(YEAR(TODAY()),01,01) && MAX('Table'[Date])<=TODAY(),1,0)

Set this filter to show items when value =1.

1.png

However if you use this measure filter in your visual, it won't show values after today or before start day.

I update a new measure, build a date table for slicer.

Measure1 = 
VAR _MINDate = MIN('Date'[Date])
VAR _MAXDate = MAX('Date'[Date])
Return
IF(MAX('Table'[Date])>=_MINDate && MAX('Table'[Date])<=IF(_MAXDate>=TODAY(),_MAXDate,TODAY()),1,0)

By this measure it will show dynamic result by slicer.

1.png

If we change slicer from 2020/12/01 to 2021/02/19, it will show result we want.

3.png

Due to you use Between in slicer, this measure has a disadvantage that if the maxdate in slicer >Today when you open your report, it will show you values in maxdate instead of today. 

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

amitchandak
Super User
Super User

@Anonymous , There is no way to default. You need to create a flag(new column) like this in the date table and use that as filter

 

Is This Year = if('Date'[Date]>=date(Year(TODAY()),1,1) && 'Date'[Date]<=TODAY(),"This year",[Date]&"")

 

refer: https://youtu.be/hfn05preQYA

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

October NL Carousel

Fabric Community Update - October 2024

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