Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have a very large table (>2m rows). I would like to replicate this excel formulation:
Basically, for each row, count the rows with the same 'Type' and where ID is up to current ID + 4.
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.
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.
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