Forum Discussion
Rocky_PBI
2 years agoRegular 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 ...
TheoC
2 years agoCommunity Champion
I'm not sure whether I've understood what you want correctly. But hopefully this is right:
- In Power BI Desktop, go to the "Home" tab, then click on "Transform Data" to open Power Query.
- In Power Query, go to the "Manage Parameters" section, then click on "New Parameter."
- Name the parameter (e.g., "PreviousDay").
- Set the parameter type to "Date."
- 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.
- 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