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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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])))

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

The 2. option does the trick, thanks.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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