Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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
Solved! Go to Solution.
@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]))
)
Proud to be a Super User! |
|
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
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
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
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
@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]))
)
Proud to be a Super User! |
|