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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
BobKoenen
Helper IV
Helper IV

Get latest amount per customer and categorie

Hi all,

I have a table with outstanding Quotations per customer and I want to return to me the last Quotation amount per categorie per customer.

 

My data looks like this:

Customer

Category

Date

Amount

In Progress

Joe

Icecream

1-1-2021

500

Y

Joe

Icecream

1-2-2021

1000

Y

Jane

Icecream

2-3-2021

600

Y

Jane

Lego

5-5-2021

1000

N

Jill

Lego

1-2-2021

600

Y

Jill

Lego

5-2-2021

5000

N

 

My desired result looks like this:

Customer

Categorie

Date

Amount

In progress

Joe

Icecream

1-2-2021

1000

Y

Jane

Icecream

2-3-2021

600

Y

Jane

Lego

5-5-2021

1000

N

Jill

Lego

5-2-2021

5000

N

I hope you can help me.

1 ACCEPTED SOLUTION

Use this instead. Sorry about that.

Latest Amount = 
VAR LatestDate = [Latest Date]
RETURN
SUMX(
    FILTER(
        'Table',
        'Table'[Date] = LatestDate

        ),
    'Table'[Amount]
)

My pbix above is updated too.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Picture1.png

 

New Table =
SUMMARIZECOLUMNS (
Data[Customer],
Data[Category],
"Date", MAX ( Data[Date] ),
"Amount",
VAR _lastdate =
CALCULATE (
MAX ( Data[Date] ),
FILTER (
Data,
Data[Customer] = MAX ( Data[Customer] )
&& Data[Category] = MAX ( Data[Category] )
)
)
RETURN
CALCULATE ( SUM ( Data[Amount] ), FILTER ( Data, Data[Date] = _lastdate ) )
)
 
 
 
 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

edhans
Super User
Super User

Here you go. 

edhans_0-1625061478650.png

You need 3 measures:

 

Latest Amount = 
VAR LatestDate = [Latest Date]
RETURN
SUMX(
    FILTER(
        'Table',
        'Table'[Date] = LatestDate

        ),
    'Table'[Amount]
)

Latest Date = MAX('Table'[Date])

Latest Progress = 
VAR LatestDate = [Latest Date]
RETURN
MAXX(
    FILTER(
        'Table',
        'Table'[Date] = LatestDate

        ),
    'Table'[In Progress]
)

 

 

My PBIX file is here for you to review @BobKoenen 

EDIT: @BobKoenen - I edited this so this one post would have all of the correct measures, and the PBIX file I linked to is correct. The screenshot is innacurate, but you can see the correct table visual that is created in the PBIX file. If this works, please mark as the solution. If not, please let me know what is not working yet for you. Thanks!

 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Thanx for your Fast Reply but unfortunatly this is not the Answer. In your example the Amounts Are summed for Jill and Joe. 
The result for Jill should be 5000 and not 5600 for Joe it should be 1000 instead of 1500. I want to return the latest value if customer and categorie are the same, not the sum

Use this instead. Sorry about that.

Latest Amount = 
VAR LatestDate = [Latest Date]
RETURN
SUMX(
    FILTER(
        'Table',
        'Table'[Date] = LatestDate

        ),
    'Table'[Amount]
)

My pbix above is updated too.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@BobKoenen - did my revised measure above solve the issue for you?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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