cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Venkatesan
Helper I
Helper I

Need a Slicer to select only two column , should not allow the user to check more than 2 checks

Hi Team,

I have a slicer visualization with dropdown , which user should select only 2 columns(checkbox) , if the user tries to check on 3rd columns it should show a  popup a warning message that "Please select only two columns" how can achieve this

I tried with below query but i cant able to achieve popup as well as  differences between two columns 

Differences = 
VAR SelectedTests =
ALLSELECTED ( 'practice'[Description] )
VAR MinValue =
MINX ( SelectedTests, CALCULATE ( AVERAGE ( 'practice'[Time] ) ) )
VAR MaxValue =
MAXX ( SelectedTests, CALCULATE ( AVERAGE('practice'[Time] ) ) )
VAR Difference = MaxValue - MinValue
VAR NumProductsSelected =
COUNTROWS ( SelectedTests )
VAR Result =
IF (
NumProductsSelected = 2,
Difference,
ERROR ( "Please select only 2 Tests." )
)
RETURN
Result

could somebody please help me to achieve this

1 ACCEPTED SOLUTION

Hi @Venkatesan ,

 

You need to drag the measure into the visual you want to slice and set the filter rules.

vcgaomsft_0-1654570181958.png

vcgaomsft_1-1654570208650.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Venkatesan , there is no way to stop, You can create a measure and display message .

 

You can make  visuals blank if more then 2 values are there

 

if(countrows(allselected(Table[Product]) ) >=2, 1,0)

 

not you can use above measure to display message and remove data from visual , above should = 0 (visual level filter)



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Hi Amit,

 

Thanks for your reply 
May i know where exactly this soultion can be implemented in my query 

Hi @Venkatesan ,

 

You need to drag the measure into the visual you want to slice and set the filter rules.

vcgaomsft_0-1654570181958.png

vcgaomsft_1-1654570208650.png

Attached PBIX file for reference.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

thanks for your support its working

Helpful resources

Announcements
Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Power BI Dev Camp Session 26

New Date - Check it Out!

Mark your calendars and join us on Thursday, October 6 at 11a PDT for a great session with Ted Pattison!

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Ignite 2022

What's Next at Microsoft Ignite 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Top Solution Authors