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
seth127
Regular Visitor

Is it possible to filter by current date?

Hello, 

I have several visuals in a report that I would like to filter to only show data for the current date. I have a slicer, with dates, so that the user can select which date to filter by, but I want to know if I can have that default to "today."

 

Similarly, there are several charts and KPI's that I'd just like a built-in filter for "today." I know that I can go into the filters section and manually chose only today's date, but I'd like for my eventual dashboard user to NOT have to do that.

 

Thanks so much for the help.

Seth

4 REPLIES 4
SivaMani
Resident Rockstar
Resident Rockstar

@seth127  We have the option to create a new table using DAX. So use that option with following script you will attain this requirement

 

Table = Filter(TableName, TableName[DateField] = TODAY())

 

TableName is Source Table name

 

 

Sean
Community Champion
Community Champion

@seth127  Just add the additional filter to those Measures so they only calculate for today

 

Today's Sales =
IF (
    ISBLANK ( CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Date] = TODAY () ) ),
    0,
    CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Date] = TODAY () )
)

 

EDIT: IF ( ISBLANK... will help you deal with Blank() showing in some Visuals such as Cards when there's no value - it will show 0 instead

Thanks. That looks great, but I'm worried I won't be able to use it. I'm connected through SSAS, which means I can't create calculated columns. That's what you're saying to do, right?

 

If I'm misunderstanding you, I'd love to know how to put a calculated measure into a card or something without having to create a new column. I haven't been able to figure that out either.

 

If that is what you were suggesting, is there a way to do this without creating a new column? Basically I want to have it work just like the filters on the right hand side work, but have it update to the current date each day.

 

Thanks again.

Hi @seth127,

 

To add a calculated column which suggested by @Sean is after loading data in Power BI Desktop, instead of in SSAS model. For more information, please refer to this article: Calculated columns in Power BI Desktop.

 

In addition, we are not able to set Report level filter based on dynamic values, we can only set specified values currently. So in your scenario, as you want to set default filter as Today() and user can also select other date, it's not supported to do it as far as I know. For this issue, I have sent a feedback internally. You can refer to this thread which I have replied: Options to have report parameters similar to what we have in SSRS.

 

If you have nay question, please feel free to ask.

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.