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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Countifs on same field and multiple criteria

I have a very large table (>2m rows). I would like to replicate this excel formulation:

siamakfr_0-1621443822849.png

Basically, for each row, count the rows with the same 'Type' and where ID is up to current ID + 4. 

3 REPLIES 3
Anonymous
Not applicable

If you've got 2 million rows, then your best option is Power Query, not DAX. If you try to do it in DAX as a calculated column (and if you try to use CACLULATE on top of that), you'll feel the pain. It'll last forever. Therefore, please take my advice: do it in Power Query.

Anonymous
Not applicable

Since in DAX there is no intrinsic concept of order, this phrase "count the rows after" calls for a column that will order the entries. Otherwise, what you want can't be done.

Anonymous
Not applicable

Thanks for your reply. I think since the ID increases as we go through the rows, I can ignore and remove this phrase. Just count of rows with the same 'Type' and where ID is up to current ID + 4

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.