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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.