March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hello,
I want to set default value selected on Power Bi desktop report. I have was able to achieve this requirement in Excel through
custom Vb script.
Is there any way by which can select default value on filters or slicers on report load ?
Is there any DAX alternative to achieve above requirement in Power BI desktop?
Thanks in advance.
Thanks for the replies.
Let me put my requirement in more specific way as per your guidance.
Let’s say on any report load, I want to auto select YTD for the Date filter. I have achieved this using custom VBA code with Excel – Pivot Tables/Charts, but not sure how will I achieve this for Power Views or Power BI Desktop, considering the fact that programming is not supported in power BI (correct me if I am wrong here).
I have understood the solution you have shared. But I think that there may be a many entities on which I might have to set default filters, and then I will be ending up creating many such filters?
Hope, I have made the things much clear now. However, please feel free to ask any further questions.
Thank you.
Hello Daxesh,
From you description it seems like you are looking for ways by which you can set filters with dynamic values. By Dynamic I mean, the value of filter is not constant.
E.g. By default you might want to set the date filter to TODAY() whenever the pbix file is opened. Now, as TODAY() will have a different value every day, you do not want to set the date filter to a specific value. Hence, you are looking for a way by which if today is 1-Mar-16 & the file is opened, date filter will be set to 1-Mar-16 and when the same file will be opened tomorrow, the date filter will be set to 2-Mar-16.
AFAIK setting default values to filters in power BI file is not supported as on date. I am not sure about the upcoming releases.
Hope this helps!
@daxesh - If you place a slicer on your page, select something in the slicer and save your report, when you reopen the file, your selection will be there.
Similarly, if you set a page filter to a certain value, it will also be saved with the report.
I feel like I am still not understanding something.
There is no programmatic access to slicer or filter selections in Power BI reports. You can set a literal filter, or a static rule which will be saved with the report. As @Greg_Deckler has described above, you can utilize the modeling components of Power BI (either Power Query M or DAX) to update your data such that the literal filter selection points to a new row of data (e.g. a today flag).
I agree with @Greg_Deckler, we need a use case or more specific example. On that note though, there is quite a bit you can do with a compbonation of DAX formulas and Visual\Page\Report filters. For example, you can write a DAX formula to find all the dates in the data set that are Today() and then mark them with a 1, and use that as a Visual level filter for an object that displays "Todays Orders" or something. You can use similar formulas to create Rolling periods, teams, regions, and more.
It depends upon what you want to do exactly. For example, can you create a DAX custom column that compares a date in the data and returns 1 if it is TODAY() and 0 if not and then set the filter in the report to "custom column = 1". Yes. Can you use DAX to determine that the user is XYZ and not ZYX and set filters automagically based upon that. Probably not. Woudl need to know your specific use case to really help out here.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
73 | |
58 | |
52 |
User | Count |
---|---|
197 | |
133 | |
107 | |
69 | |
65 |