Forum Discussion
Latest Invoice Amount - Iternation
Hello,
I Have a table of invoices to that was submitted to the health insurance company that looks similar to this:
| Invoice No. | Mode (1- submission, 2- Resubmissition, 3- Correction) | Amount |
| VAN10001 | 1 | 100 |
| VAN10001 | 2 | 100 |
| VAN10002 | 1 | 500 |
| VAN10002 | 3 | 420 |
| VAN10003 | 1 | 800 |
| VAN10003 | 3 | 950 |
| VAN10003 | 2 | 950 |
I want to create a column that has the latest invoice Amount where any correction happend, smiliar to below
| Invoice No./ | Amount |
| VAN10001 | 100 |
| VAN10002 | 420 |
| VAN10003 | 950 |
6 Replies
- amitchandakSuper User
Mamoun_issa , Try with invoice no in visual
lastnonblankvalue(table[mode], max(Table[amount]))
- Mamoun_issaFrequent Visitor
Thank you, but this will get me the max, assuming some invoices became less
- amitchandakSuper User
- Greg_DecklerCommunity Champion
Mamoun_issa - You could do that as a measure in a table visualization with Invoice No. I mocked it up and provided a sample PBIX for you. It is Table (10), Measure (10) on Page 10.
Measure 10 = VAR __ModeMax = MAX([Mode]) RETURN MAXX(FILTER('Table (10)',[Mode] = __ModeMax),[Amount])See attached PBIX below sig.
- FowmySuper User
Mamoun_issa
You can add a new column with the code below:Latest Amount = VAR M = CALCULATE( MAX(Table1[Mode]), ALLEXCEPT(Table1,Table1[Invoice No.]) ) VAR I = CALCULATE( MAX(Table1[Invoice No.]), Table1[Mode] = M, ALLEXCEPT(Table1,Table1[Invoice No.]) ) RETURN IF( Table1[Invoice No.]=I && Table1[Mode] = M , Table1[Amount] , BLANK() )________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
- Crystal_YWHelper I
I'v solved your problem based on the assumption that each invoice no has at most 3 times for submission
please let me know if it works for you