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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Miguel_Rojo
Frequent Visitor

Controls the behavior of one slicer, based on the selection of a second slicer

Hi community!

 

Do you know if Power BI provide a direct way to dynamically control the default selection of one slicer based on the selection of another slicer?

  • If you have two slicers "Year Slicer" and "Month" Slicer"
  • Objective: If you change the year in your "Year Slicer", automatically you second slicer would select "the last month available" 

 

I’d like to hear your advice in the next topic:

 

I have a set of measures,  which calculation takes as reference a month from my main slicer (please  take a look to my first screenshot):

Screen_1.png

 

Now, in oirder to  "the main slicer" only shows the months of one single year, and that the user could choose an specific year, I inserted a second slicer and changed the "Interaction Propperties" between them (this, to prevent, for example, taht when selecting a month of the 2023 year in my main slicer, my second slicer could still show the year 2022):

Screen_2.png

 

The problem is, that if my main slicer selects an specific month of one year, and then I want to select another year in my second slicer; my measures shows an ugly error message, untill I select a month of the new "Selected Year" that I want to see. Please see below the whole behaivor:

Screen_3.png

Screen_4.png

Screen_5.png

 

Do you know how can I mange the error, between the interval of choosing "a month of the new year selected"??

(i want to avoid those error messages, but in my slicers always must be "one selected field").

 

Or do you have another type of solution?

 

I attached a sample .pbix (URL) file if that can improve the communication, https://drive.google.com/file/d/19hFoaUFmiYdOIO7Xr0siVPPxuPlYwCw0/view?usp=sharing 

 

Hope you can advise!!!

 

 

 

4 REPLIES 4
audreygerred
Super User
Super User

Rather than the concatenated field in the slicer with year and month, perhaps just use a year filter and a month filter. 

audreygerred_0-1696357601542.png

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @audreygerred ,

 

I tried that step, but even though different years share the same "Month name", Power Bi keeps linking the "Month" to a specifi year, and when make the switch returns same error.

It's really strange; do you knwo if there's a way in which you can catch that error, indicating a "default date selection"?

 

Thanks in advance!

Do you have a date table in your model? If not, I would add one. Here is a blog I wrote about date tables and a link to get my favorite date table to add to your model. Once you have the date table in and connected to your fact table, you can use year and month separately like I had in my screenshot.

http://powerbiwithme.com/2023/08/01/the-custom-date-table-edition/ 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @audreygerred,

 

I Followed your advice (Amazing blog btw!!).

The thing with that approach, is that when having 2 slicers: "Month" & "Year":

 

  • If you select a month that has not occurred in your most recent year, and then switch the year, you have the same error.

Switching_Year_V1.png

 

  • And adding months that has not occured to your current year, to solution the issue, creates confussion in the data story telling:

Switching_Year_V2.png

Do you know if  Power BI provide a direct way to dynamically control the default selection of one slicer based on the selection of another slicer?

  • (To make that "once I select another year, by default my month slicers selects the last month of that new year" and avoid the error)

 

Hope you have faced and resolved similar issues 🙌

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.