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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Super User
Super User

@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. 


@ 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!:
The Definitive Guide to Power Query (M)

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]))

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

@Mamoun_issa , find the file attached.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors