Forum Discussion
Substitutes for EARLIER?
Hi,
My question comes down to "the best practices". I've had this problem quite a few times and I don't know how to approach it in the right way. So, let's say that I have some table with sales amount and customer id. What I would do to get aggregated value for each customer would be:
CALCULATE(SUM(table[sales_amount]);FILTER(table;table[customer_id]=EARLIER(table[customer_id]))
However, working with VS studio tabular model designer, this usually results in freezing editor and urgent need to use crtl + alt + delete.
I just wonder if there is some more memory-efficient solution or is it my tabular model design that is bad. I would be very grateful if someone could point me to the right direction.
2 Replies
- amitchandak
Super User
Anonymous , You can create a measure
CALCULATE(SUM(table[sales_amount]);allexcept(table[customer_id]))
- parry2k
Super User
Anonymous I don't know why would you use anything in the filter, the simple sum should work, just drop customer and sum(amount) measure on the visual and it would work, until I'm missing anything.
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!