Forum Discussion
tgalla01
3 years agoFrequent Visitor
Counting/Sequencing based on multiple columns within the same table
Hi everyone! I hope this is a quick one for somebody... I have an "orders" table that I need to insert a new DAX column into. I prefer to avoid M if possible due to the table size. I need to coun...
- 3 years ago
Hi, tgalla01
You can try the following methods.
Column:OrderCount = CALCULATE ( COUNT ( 'Table'[Order] ), FILTER ( 'Table', [Order] <= EARLIER ( 'Table'[Order] ) && [Customer_ID] = EARLIER ( 'Table'[Customer_ID] ) ) )RANK = RANKX ( FILTER ( 'Table', [Customer_ID] = EARLIER ( 'Table'[Customer_ID] ) ), [Order], , ASC )Both methods will get the results you expect.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Bifinity_75
Solution Sage
3 years agoHi tgalla01 , try this measure:
OrderCount = RANKX(FILTER('Table', 'Table'[Customer_ID] = EARLIER('Table'[Customer_ID])), RANKX(ALL('Table'), 'Table'[Order]), , DESC, Dense)Best regards