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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ellac
Helper III
Helper III

Calculated column filter - for grouping rows

Hi!

 

I want to create a calculated column in tabular editor which will be used as a filter in reports. You could say, what I want to achieve, is a type of grouping of rows. I want to create "Order type head" in the example below. 

The order head consists of all the order rows. If all order rows have the same "Order type row", we want "Order type head" to also have that value.

 

BUT, if we have an order head that consists of order rows with "Order type row" that BOTH are A and B, we want "Order type head" to be mixed. 

Order head

Order row

Order type row

Order type head

1

1

A

A

1

2

A

A

2

1

B

Mixed

2

2

A

Mixed

3

1

B

B

3

2

B

B

 

In words I want to be able to filter out order heads that only consists of one "Order type row", otherwise "mixed" is returned. 

 

Any tips on how to achieve this in a calculated column?

 

/Ella 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @ellac 

please try

Order Type Head =
IF (
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( 'Table'[Order type row] ),
            ALLEXCEPT ( 'Table', 'Table'[Order head] )
        )
    ) = 1,
    'Table'[Order type row],
    "Mixed"
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @ellac 

please try

Order Type Head =
IF (
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( 'Table'[Order type row] ),
            ALLEXCEPT ( 'Table', 'Table'[Order head] )
        )
    ) = 1,
    'Table'[Order type row],
    "Mixed"
)

Hi @tamerj1, thanks for your answer! It's working like a charm 😄

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.