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
Anonymous
Not applicable

Date parameter in power bi

My data source is an Oracle view

I have already defined few slicers based on columns from this view

 

Now user wants to enter a date of his choice (lets call it p_date), and I have to filter the data like below

 

select column1, column2

from myview

where column_date < p_date

 

how can I add a user defined date parameter in power bi and give above condition, in addition to the slicers i am using ?

5 REPLIES 5
amitchandak
Super User
Super User

I am assuming you want to filter data in power bi and you have a date slicer.

Prefer to have a calendar in powerbi, in case of import or in database in case of direct query.

 

You need to have a measure along with you groupby to have date filter used

Measure =

var _max = maxx(date,date[date]) //date calendar date

return

calculate(count(table[col1]),date[date]<_max)

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Anonymous
Not applicable

I have created a parameter by going to Manage Parameters, but how can I associate that parameter to my dataset

TomMartens
Super User
Super User

Hey @Anonymous ,

 

this can not be done, because of the following,

QueryParameters can be used to control the data that will be imported, on data import, it's not possible to consider slicer selections made by users.

Another thing about query parameters, as soon as the report gets published the parameter becomes "public" and is no longer specific to any user, as the parameter belongs to the dataset.

 

You might consider to switch to a direct query dataset (be aware that this means you have to rebuild your existing reports) and provide another date slicer.

 

Regards,

Tom

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

Hi, this is a direct query. I have created a date parameter using Manage parameters, can I associate this with my data source ?

Hey @Anonymous, 

 

you can't.

 

Parameters inside Power Query (my assumption from "Manage Parameters") can not be changed by users.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.