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.
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 ?
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
I have created a parameter by going to Manage Parameters, but how can I associate that parameter to my dataset
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
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
100 | |
88 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |