cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User III
Super User III

Re: Remove Duplicates?

Hey,

 

I guess the row to use would be, the row with the MIN('table'[RemainingPayment].

 

So, without trying I would define a 2nd variable

minRemainingPayment = 
CALCULATE(
  MIN('table'[RemainingPayment])
)

and adjust the IF statement like so

IF('OrdersPayment'[Date] = latestOrderDate && 'OrdersPayment'[RemainingPayment] = minRemainigPayment

Hope this helps

 

Regards

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
Super User III
Super User III

Re: Remove Duplicates?

Hey,

 

without knowing yor business rules it's just guesswork, but the constraint "more than one row" has to be considered no matter what date is used.

 

Blank "Remaining Payment" rows are due to the "Goods in transit" concept, from my point of view these goods to not affect the remainig payment, but maybe you have another kpi that exactly describes the difference between "goods send" and "goods received".

 

Regards

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
Super User III
Super User III

Re: Remove Duplicates?

Hey,

 

and as I was staring on the measure I would rewrite the measure for performance reason like so

Remaining Payment latestOrder optimized = 
SUMX(
VALUES('OrdersPayment'[ID])
,
var latestOrderDate = 
	CALCULATE(MAX('OrdersPayment'[Date]))
var minRemainigPayment =
	CALCULATE(MIN('OrdersPayment'[RemainingPayment]))
return

CALCULATE(
	SUM('OrdersPayment'[RemainingPayment])
	,'OrdersPayment'[Date] = latestOrderDate 
	,'OrdersPayment'[RemainingPayment] = minRemainigPayment
			
		)
	)

Regards

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
CTan42 Helper II
Helper II

Re: Remove Duplicates?

@TomMartens

I would like to explain what am i doing at the moment (the business rules).  The data is from a normal food shops. Basically the idea is to find out how many (orders) and how much (values) of goods are yet to be received. As the goods are yet to be received, the payment won't be made until the goods are received. For the orders part, it is easy to calculate. I can just use 'distinctcount' function for the ID as every goods has a unique ID. For the payment part, it was the hardest part. I need to calculate how much payment for those goods (yet to be received). Wish you could understand what am i doing atm. 🙂 really appreaciate ur help.

Regards.

Super User III
Super User III

Re: Remove Duplicates?

Hey, thanks for the explanation.

 

Can you provide sample datarow that depicts goods in transit, not yet received by a store and not yet payed. Does your table also distinguishes between orderdate, shipdate and receiveddate, also for the figures quantity and payment.

 

Regards

 

Hamburg - Germany
If I answer your question, please mark my post as solution, this will also help others.
I accept Kudos :-), If you find my post helpful.

Proud to be a Datanaut!
Highlighted
CTan42 Helper II
Helper II

Re: Remove Duplicates?

@TomMartens

My table contain orderdate, delivery date and received date and also for the figures quantity and payment. I will need some time to provide sample datarow. Thanks

 

regards.

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors