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

Be 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

Reply
daxesh
Helper I
Helper I

Is there any DAX alternative to set the default filters

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.

6 REPLIES 6
daxesh
Helper I
Helper I

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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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).

Nhallquist
Helper V
Helper V

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.  

Greg_Deckler
Super User
Super User

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.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.