Dax Table Functions help

Hi All,
I am struggling to calculate sum of the values of column based on a condition.

Table3

  1. Order Id
  2. Total Defect Products
  3. DateTime

So, I get data on number defective products that are identified on a particular Order ID. However, for some order Ids more defective products are identified at later point in time and that is recorded by adding a new row with the same Order ID and updated Total defect products. This causes Duplication of the Order ID, and when I calculate total defective products the number are higher than what it should be. For example
Order ID 20230001537 first had 1 defective product , it was then updated to 2 . Now, when i am calculating the sum, it should only take 2 and ignore 1.

I created a calculated column - dups to give me all the duplicate Order Ids.

latest.pbix (2.7 MB)

1 Like

Hey,
Hope you are doing well!
It is filtering the values based on initial context.
Go through the pbix.
let me know in case any further discussion is required.
latest.pbix (2.7 MB)

Hi Pankaj, Thanks for your time and effort. But, i don’t think it is doing what I want it to do.

For instance- Order ID - 20230001537 is giving Measure 3

But, It should only give 2.

Although the time here is same but 2 is the right value as it bigger than the previous. Sorry

I think I am able to resolve the problem by using this code

So, All good. Thanks Pankaj.