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

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.

Reply
hawkeyes12
Frequent Visitor

Power BI Dax Formula

Hello,

 

I am trying to create a Measure in Power BI that will execute a measure only if "Select all" is chosen in a Slicer. Any ideas on how to incorporate this?

 

Here are some additional details on my data:

1. I have 4 tables: Calendar, States, State Tests and County Tests

2. I have a line chart visual showing the number of tests for each day (this is a measure)

3. I have two slicers to enable filtering; 1 for States and 1 for Counties

4. If I choose "Select all" in the county filter, I want the bar charts to show. But if I choose a specific county or multiple counties, I do not want the bar charts to show. 

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

You could use this approach:

 

Conditional Measure = IF(ISFILTERED(Table[County]), BLANK(), [Your Measure])

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

3 REPLIES 3
mahoneypat
Employee
Employee

You could use this approach:

 

Conditional Measure = IF(ISFILTERED(Table[County]), BLANK(), [Your Measure])

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


This worked!! thanks so much @mahoneypat !

lbendlin
Super User
Super User

You will want to use FILTERS() and COUNTROWS() to identify that situation. Caution: You may  need to cover two separate scenarios. When no items are selected, and when all items are selected.

 

https://docs.microsoft.com/en-us/dax/filters-function-dax

 

EDIT:  Never mind, both scenarios return the same number (count of all slicer items)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors