Forum Discussion
Assistance needed with formula
- 9 years ago
You need to get familiar with the early function. It's one of those functions that I'm not totally sure why it works, I just know it does. So let's learn by doing.
So you can use this function to create a count of the rows that have each unique key. The syntax would be:
=CALCULATE(COUNTA([KEY]),FILTER('TABLENAME','TABLENAME'[KEY]=EARLIER('TABLENAME'[KEY])))
This would be the denominator in your equation, so you could just put a "1/" in front of the above equation to get your proper value.
That should work for you. Let me know.
You need to get familiar with the early function. It's one of those functions that I'm not totally sure why it works, I just know it does. So let's learn by doing.
So you can use this function to create a count of the rows that have each unique key. The syntax would be:
=CALCULATE(COUNTA([KEY]),FILTER('TABLENAME','TABLENAME'[KEY]=EARLIER('TABLENAME'[KEY])))
This would be the denominator in your equation, so you could just put a "1/" in front of the above equation to get your proper value.
That should work for you. Let me know.
Works good! Thanks!
About the earlier function, I am using it in the same model inside a filter, but still I can't get why...
Link to the discussion
- TheOckieMofo9 years ago
Resolver II
Yeah, the EARLIER function is just one of those things. I always liken it to Calculus. I don't know how derivates/integrals work, but I assume the French guys in the 1700s got it right, so I use it. The only thing we need to know is when to apply it.
Anytime you need to compare rows instead of compare columns, you're probably going to use the Earlier function at some point.