cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Count where count > 1 based on grouping

I have been asked to do an analysis on orders with multiple shipments/colli.

Below a screenshot of a matrix visual with order number. A count of tracking codes and a sum of colli.

I would like to count tracking codes where the previous count is bigger than one. grouped by order number.

So in the example below I would expect to see blank rows on the 1 rows. And 150 as a total in the matrix / card visuals.

I think this would be something like this in SQL. But I'm not sure how to do this in DAX.

SELECT order_number,

COUNT(track_and_trace)
WHERE COUNT(track_and_trace > 1

GROUP BY order_number

1 ACCEPTED SOLUTION
Super User

Try plot with the OrderNumber column and a measure like:

count of Track and Trace =

VAR _count = COUNTROWS(TableName)

RETURN

IF(_count=1, BLANK(), _count)

for the total card visual, try like:

1PlusCountTotal =

VAR _table =

VALUES(TableName[OrderNumber]),

"Count",

CALCULATE(COUNTROWS(TableName))

)

RETURN

COUNTROWS(

FILTER(

_table,

[Count]>1

)

)

Super User

Try plot with the OrderNumber column and a measure like:

count of Track and Trace =

VAR _count = COUNTROWS(TableName)

RETURN

IF(_count=1, BLANK(), _count)

for the total card visual, try like:

1PlusCountTotal =

VAR _table =

VALUES(TableName[OrderNumber]),

"Count",

CALCULATE(COUNTROWS(TableName))

)

RETURN

COUNTROWS(

FILTER(

_table,

[Count]>1

)

)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors