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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
TonyVardo
Frequent Visitor

Show orders placed 48 hours and older.

Hello,

I just started working with Power BI and I managed to create my first report. I am stuck on the date/hours filter.

I'm connecting to a SQL database via Direct Query. In one of the Gauges I need to show Orders placed in the last 48 hours or older. I can't do advanced filtering because I need all the dates YTD for other tables and Gauges. The only option I see to filter is from Visual level filters (Advanced filtering "is on or before"), but I need to change that every day to keep it up to date.

Is there a DAX measure to calculate date +48 hours?

 

Thanks in advance.

7 REPLIES 7
BalaVenuGopal
Resolver I
Resolver I

Hi @TonyVardo ,

 

You add flag at sql query which will tell you orderpalced+48 is true or false.

At report level use visual filter only for the visual you need and apply flag = true for this visual filter.

 

Hope this will resolve you help.

 

Please mark as solution if this works for you

I can't select True/False because it is a direct Query.

 

Hi @TonyVardo

 

Use Visual level filter at report level or you can create measure and use flag clumn in filter

@BalaVenuGopal None of the visual slicers are working for Direct Query. I have been working with Microsoft tech support and after 3 days of back and forth, this is the only option they gave me:

 

You will have to perform the below changes:

Use the DATEDIF() function in the Dax to know the difference between print_date and Now()

Get this in hours, create a rule for greater then 48hours  using the “If” condition.

 

This is like asking a baby that just started walking to start running 🙂

@BalaVenuGopal

Thank you for your tip. I have been trying to find a DAX for the measure and I haven't had any luck. Do you have any DAX formula that applied to my scenario? 

p.s. DAX Formula Compatibility in DirectQuery Mode

parry2k
Super User
Super User

Did you looked at relative filtering for date? That will do it. You will find this as an option when you filter on date column.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Relative date filtering it only shows:

"is in the last" days (only 24 hours older),weeks,calendar weeks, months and so on OR 

"in this day" OR

"is in the next"

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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