Forum Discussion
Anonymous
5 years agoNot applicable
Difference between two values in the came column.
Hi there.
I am fairly new to PowerBI and can't seem to get this right.
I want to get the difference between two values in the same column and that will show in a new column.
See data table below
| Year | Projected No. of Swimmers | Difference |
| 2021 | 335196.8 | |
| 2026 | 354965.5 | +19,768.7 |
| 2031 | 370396.1 | |
| 2036 | 383843.7 | |
| 2041 | 394566.4 | |
| 2046 | 403489.4 | |
| 2051 | 412977.8 |
What would be the DAX for this?
Anonymous
sry, typo error in the DAX. pls change minx to maxx
Column =var last=MAXX(FILTER('Maintain Participation','Maintain Participation'[Projected No. of Swimmers]<EARLIER('Maintain Participation'[Projected No. of Swimmers])),'Maintain Participation'[Projected No. of Swimmers])return if(ISBLANK(last),blank(),'Maintain Participation'[Projected No. of Swimmers]-last)
5 Replies
- ryan_mayu
Super User
Anonymous
pls try this
Column = var last=minx(FILTER('Table (3)','Table (3)'[Projected No. of Swimmers]<EARLIER('Table (3)'[Projected No. of Swimmers])),'Table (3)'[Projected No. of Swimmers]) return 'Table (3)'[Projected No. of Swimmers]-lastif you want the blank for first row. try this
Column = var last=minx(FILTER('Table (3)','Table (3)'[Projected No. of Swimmers]<EARLIER('Table (3)'[Projected No. of Swimmers])),'Table (3)'[Projected No. of Swimmers]) return if(ISBLANK(last),blank(),'Table (3)'[Projected No. of Swimmers]-last)- AnonymousNot applicable
Hi there.
Thank you for your reply.
It doesn't seem to be working for me as I am getting a message that "The end of the input was reached".
The table name is Maintain Participation if you could try again using that as the name of the table?
- ryan_mayu
Super User