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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Rocky_PBI
Regular Visitor

Date parameter for Previous date

Hi Experts ,

 

I have one requiremnet in Power BI, i have multiple tables in power querry every table need to filter on date column by using date parameter. How to create current date -1 parameter which will give previous day data. I only need create in power querry. any solution for create date parameter and how will pass it on my date table.

2 REPLIES 2
TheoC
Super User
Super User

@Rocky_PBI 

 

I'm not sure whether I've understood what you want correctly. But hopefully this is right:

 

  1. In Power BI Desktop, go to the "Home" tab, then click on "Transform Data" to open Power Query.
  2. In Power Query, go to the "Manage Parameters" section, then click on "New Parameter."
  3. Name the parameter (e.g., "PreviousDay").
  4. Set the parameter type to "Date."
  5. For the "Current Value," use a formula to set it to yesterday's date using M code:  Date.From(DateTime.LocalNow()) - #duration(1,0,0,0). This should get today's DateTime, convert it to a Date, then subtract one day.
  6. For each table where you want to apply this filter:
    • Select the table in Power Query.
    • Go to the date column that you want to filter.
    • Apply a date filter but instead of selecting a specific date, select the "Date/Time Filters" and then "Custom Filter."
    • In the filter dialog, set it to show rows where the date column is equal to the parameter you created.

 

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @TheoC 

Thanks for replying... Will try that way. But the main motive is  When user run the report he should get the date prompt popup then he will select the dates ranges

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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