Forum Discussion
DAX: Help with dynamic calculated column
- Anonymous5 years ago
Hi astojanac,
It sounds like multiple aggregate requirements, you can try to add a variable with summarize function to apply the first aggregation then use the iterator function with that variable to enable another aggregation.
All the secrets of SUMMARIZE - SQLBI
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng
astojanac See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/339586.
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
Hi Greg_Deckler ,
Thanks a lot for the answer, but unfortunately I can't find way out with this kind of formula.
My formula returns nicely, however the problem is that it does not calculate interest on every amount but collects all payments and then calculates interest. Is there a chance you can help me overcome this problem?
Thanks in advance!
- Anonymous5 years agoNot applicable
Hi astojanac,
It sounds like multiple aggregate requirements, you can try to add a variable with summarize function to apply the first aggregation then use the iterator function with that variable to enable another aggregation.
All the secrets of SUMMARIZE - SQLBI
Measure Totals, The Final Word
Regards,
Xiaoxin Sheng