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
Akos07
Helper I
Helper I

Last sale amount by partner

Hello,

 

I have the following problem and i need some advice.

 

I would like to create the following:

Partner - last sales date - last sale amount - AVG sales by partners
1 - 2021.08.20 - 7000 - 2430
2 - 2021.08.22 - 6500 - 3000


I have the partner and the last sales date, but cant figure it out how to put the rest 2 columns

My tables:
One table that countains all documents, sales deliveris etc, with dates, and partner datas.

ID - PartnerID - Fullfillmentdate - Type - Amount
1 - 1 - 2021.07.01 - Sale - 4500
2 - 1 - 2021.08.20 - Sale - 7000
3 - 2 - 2021.08.10 - Sale - 100
4 - 2 - 2021.08.22 - Sale - 600
5 - 2 - 2021.08.22 - Sale - 6500

On the same day there could be more sales and i need the last one by table ID, and fullfillmentdate.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Akos07 , Please try a measure like

 

Measure =
VAR __id = MAX ('Table'[PartnerID] )
VAR __date = CALCULATE ( MAX('Table'[Fullfillmentdate] ), ALLSELECTED ('Table' ), 'Table'[PartnerID] = __id )
CALCULATE ( sum('Table'[Amount] ), VALUES ('Table'[PartnerID ] ),'Table'[PartnerID] = __id,'Table'[Fullfillmentdate] = __date )

 

or

 

calculate(lastnonbalnkvalue('Table'[Fullfillmentdate] ,sum('Table'[Amount])), filter(allselected('Table'), 'Table'[PartnerID] = max('Table'[PartnerID])))

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Akos07 , Please try a measure like

 

Measure =
VAR __id = MAX ('Table'[PartnerID] )
VAR __date = CALCULATE ( MAX('Table'[Fullfillmentdate] ), ALLSELECTED ('Table' ), 'Table'[PartnerID] = __id )
CALCULATE ( sum('Table'[Amount] ), VALUES ('Table'[PartnerID ] ),'Table'[PartnerID] = __id,'Table'[Fullfillmentdate] = __date )

 

or

 

calculate(lastnonbalnkvalue('Table'[Fullfillmentdate] ,sum('Table'[Amount])), filter(allselected('Table'), 'Table'[PartnerID] = max('Table'[PartnerID])))

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

The 2. option does the trick, thanks.

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.