cancel
Showing results for
Did you mean:
Resolver II

## If >2 Selections, do not display the graph, else display the graph

Hey,

I'm trying to make a measure that will not display a sum on a graph if certain criteria are met. However, instead of breaking it goes ahead and displays the sum regardless of whether or not the if statement conditions are met. How can I make a measure that will not display aggregated counts if certain criteria are met?

Ex -

Input: 24, 52, 37

Measure: If(Count(Input)>2, "Please maintain 1-2 inputs", Sum(Input)

Desired Output: "Please maintain 1-2 inputs"

Actual Output: Sum(Input)

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support

## Re: If >2 Selections, do not display the graph, else display the graph

HI @SBuri,

Greg's suggestion seems well, I share the sample formula here.

```Measure =
IF (
COUNTROWS ( ALLSELECTED ( Table[Input] ) ) > 2,
SUMX ( ALLSELECTED ( Table[Input] ), [Input] )
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
3 REPLIES 3
Super User IV

## Re: If >2 Selections, do not display the graph, else display the graph

Might have better luck with COUNTROWS instead of COUNT if it is a table.

---------------------------------------

Not the Power BI thought police...

##### I have NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Datanaut!

Community Support

## Re: If >2 Selections, do not display the graph, else display the graph

HI @SBuri,

Greg's suggestion seems well, I share the sample formula here.

```Measure =
IF (
COUNTROWS ( ALLSELECTED ( Table[Input] ) ) > 2,
SUMX ( ALLSELECTED ( Table[Input] ), [Input] )
)
```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
Resolver II

## Re: If >2 Selections, do not display the graph, else display the graph

Thank you both!!

Announcements

#### New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

#### ‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

#### Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Top Solution Authors
Top Kudoed Authors