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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
webstark
Frequent Visitor

Counting number of rows where number equals something

Hi team,

 

Very simple one here.

 

I have the table below. I have a Site ID, a Pallet ID and a count of the 

number of boxes on pallet (this is a count selection on the dropdown). A pallet can 1 or more boxes on it.

 

The number of boxes will either be 1 or >= 2.

 

I just want another 2 measures where the count of all the 1's = something and >=2 = something else. How many times does the one appear and how many times is it 2 or more?

 

I can do it in T-SQL but I just can't get a Filter working properly.

 

Help!

 

 

Capture.JPG

1 ACCEPTED SOLUTION

Hi @webstark,

 

Is [Id] in above table in your post a column or measure?

 

Suppose it is a column, please try these two measures:

palletd 1 =
CALCULATE (
    COUNT ( 'Palletd Table'[Palletd] ),
    FILTER ( ALL ( 'Palletd Table' ), 'Palletd Table'[Id] = 1 )
)

palletd 2 =
CALCULATE (
    COUNT ( 'Palletd Table'[Palletd] ),
    FILTER ( ALL ( 'Palletd Table' ), 'Palletd Table'[Id] >= 2 )
)

1.PNG

 

If it doesn't meet your request, please post source data in data view and show us your desired output.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
miltenburger
Helper V
Helper V

CountValues =
CALCULATE ( COUNTROWS ( TableName ); TableName[Id] = 1 )

I think this is what you need, just fill in your tablename 

Sorry, it looks like it's just comparing the integer values.

 

When I put in = 1, I get Blank(), but >= 2 equals everything in the table.

 

40044114083914688 is greater than 2..everything matches

40044114083914688 = 1, blank().

Hi @webstark,

 

Is [Id] in above table in your post a column or measure?

 

Suppose it is a column, please try these two measures:

palletd 1 =
CALCULATE (
    COUNT ( 'Palletd Table'[Palletd] ),
    FILTER ( ALL ( 'Palletd Table' ), 'Palletd Table'[Id] = 1 )
)

palletd 2 =
CALCULATE (
    COUNT ( 'Palletd Table'[Palletd] ),
    FILTER ( ALL ( 'Palletd Table' ), 'Palletd Table'[Id] >= 2 )
)

1.PNG

 

If it doesn't meet your request, please post source data in data view and show us your desired output.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.