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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
GR83
Regular Visitor

Multiple filter selected to show zero a value

I have a filter on page 

with fields 

State 

City


if I select any one or multiple cities in static list (NYC, Rochester, Buffalo)

i need sum  total of sale  should be zero else actual sum of sales.

if I select New York State the sales should be total actual sale.

i tried 

IF(selectedvalue(city)) in {NYC,Rochester, Buffalo), 0, 

Calculate(sum(sale))

I understand that selected value give only one value hence when multiple cities in the list are selected it gives actual sale rather than 0.

 

how can I do this ?

 

thanks

 

 

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@GR83 , Try using

 

DAX
Sales Measure =
IF (
ISFILTERED('Table'[City]) &&
(
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "NYC") ||
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "Rochester") ||
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "Buffalo")
),
0,
CALCULATE(SUM('Table'[Sale]))
)




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

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @GR83 

 

@bhanu_gautam 's solution should work. The use of ISFILTERED is very smart. 

 

In addition, here is another measure you can try, not very smart, because the part 

COUNTROWS(VALUES('Table'[City])) < CALCULATE(DISTINCTCOUNT('Table'[City]),ALL('Table'[City])) does the same thing as ISFILTERED('Table'[City]) but makes the formula longer. 
Sales Measure = 
IF(
    COUNTROWS(INTERSECT(VALUES('Table'[City]),{"NYC", "Rochester", "Buffalo"})) > 0 
    && COUNTROWS(VALUES('Table'[City])) < CALCULATE(DISTINCTCOUNT('Table'[City]),ALL('Table'[City])), 
0, 
CALCULATE(SUM('Table'[Sale]))
)

 

Best Regards,
Jing
Community Support Team

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @GR83 

 

@bhanu_gautam 's solution should work. The use of ISFILTERED is very smart. 

 

In addition, here is another measure you can try, not very smart, because the part 

COUNTROWS(VALUES('Table'[City])) < CALCULATE(DISTINCTCOUNT('Table'[City]),ALL('Table'[City])) does the same thing as ISFILTERED('Table'[City]) but makes the formula longer. 
Sales Measure = 
IF(
    COUNTROWS(INTERSECT(VALUES('Table'[City]),{"NYC", "Rochester", "Buffalo"})) > 0 
    && COUNTROWS(VALUES('Table'[City])) < CALCULATE(DISTINCTCOUNT('Table'[City]),ALL('Table'[City])), 
0, 
CALCULATE(SUM('Table'[Sale]))
)

 

Best Regards,
Jing
Community Support Team

bhanu_gautam
Super User
Super User

@GR83 , Try using

 

DAX
Sales Measure =
IF (
ISFILTERED('Table'[City]) &&
(
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "NYC") ||
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "Rochester") ||
CONTAINSSTRING(CONCATENATEX('Table', 'Table'[City], ","), "Buffalo")
),
0,
CALCULATE(SUM('Table'[Sale]))
)




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

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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