Forum Discussion
Grab data from most recent row available
- 4 years ago
jwin2424 please use the following
_Balance = CALCULATE ( MAX ( 'Table'[Balance] ), FILTER ( 'Table', VAR _mxIndex = CALCULATE ( MIN ( 'Table'[Index] ), ALL ( 'Table' ) ) RETURN 'Table'[Index] = _mxIndex ) )
jwin2424 , You need to add an index column and try
Lastnonblankvalue(Table[Index], max(Table[Amount] ))
https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi
Actually the index column option is in there, just under the transform data mode. I added the index, and unless I am missing something, the formula just returns the index column verbatum.
- smpa014 years ago
Community Champion
jwin2424 once you have index, you can put that into use like this
_Balance = CALCULATE ( MAX ( 'Table'[Balance] ), FILTER ( 'Table', VAR _mxIndex = CALCULATE ( MAX ( 'Table'[Index] ), ALL ( 'Table' ) ) RETURN 'Table'[Index] = _mxIndex ) )- jwin24244 years ago
Resolver I
A B C D E Posting Date Description Amount Balance Index 1 12/5/2021 Groceries -53.62 674.45 1 2 12/5/2021 Gas -42.81 728.07 2 3 12/5/2021 Rent -1800 770.88 3 4 12/5/2021 Utilities -213.12 2570.88 4
You'll have to forgive me, as I am still learning how to use Power BI. My table has the index column (created in edit query) and then I went to my visualization section and created a card. I made a measure (by selecting the table I wanted it for in the fields area and then selecting "add measure). I entered in the formula, and it looks like I got a massive balance in return.
The dats is pulled in decending order, so the most recent transaction is at the very top. I simple want the card to say "674.45."
Thank you for helping!