Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Mamoun_issa
Frequent Visitor

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
VAN100011100
VAN100012100
VAN100021500
VAN100023420
VAN100031800
VAN100033950
VAN100032950

 

 

I want to create a column that has the latest invoice Amount where any correction happend, smiliar to below

 

Invoice No./Amount
VAN10001100
VAN10002420
VAN10003950
6 REPLIES 6
Crystal_YW
Helper I
Helper I

Capture.JPG

 

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

Fowmy
Super User
Super 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() )

 

Fowmy_0-1599030367120.png

 

________________________

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 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Greg_Deckler
Community Champion
Community 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. 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Mamoun_issa , Try with invoice no in visual

lastnonblankvalue(table[mode], max(Table[amount]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you, but this will get me the max, assuming some invoices became less

@Mamoun_issa , find the file attached.

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.