# Calculate Total Yield Based on Latest Date But Display in Latest Month

I have an interesting challenge in that I need to determine the %yield of a product where the consumption of the product occurs over many months.

The objective is to display in the visuals the yield% in the last month of consumption, below I have 2 images that may help.

In image 1, below the last date of consumption was 5/11/21, how can i calculate the yield and then to display in the visuals in the month of May for FY21 (yield = 810.63 / 883.33)

In the below image the latest date in 6/10/2021, again need to same as above

If someone can point me to an example in the eDNA domain, I’ll give it a shot, if not I’ll revert back.

Regards
J

I think this is going to be a relatively easy task for PQ, based on the same type of allrows grouping and identification of the max date by group technique we used in the last solution we worked on together. I think this video will be very helpful to you:

However, in the example above, can you please explain in a bit more detail how the 810.63 andd the 883.33 figures are derived?

Thanks!

• Brian

@BrianJ

The 810.63 is the sum of the yield quantity column, for order # 1295624 and operation number 110.

The 883.33 is the quantity that was issued to the order. I only need a single occurrence of the issued quantity to determine the yield, thus 810.63 / 883.33 = 91.76%

Hope this helps

Regards
J

Thanks for the clarification. The techniques in the video cited above should make quick work of this problem.

• Brian

@BrianJ

The Group By suggestion worked like a treat, thanks for your assistance.

Regards
J

Great - glad to hear that worked well for you. Once you get in the habit of using the Group By/All Rows pattern, you’ll find that you begin to see applications for it absolutely everywhere. That pattern alone has dramatically reduced the amount of DAX I write.

• Brian