Forum Discussion
wlandry12
4 years agoFrequent Visitor
DAX measure for comparing MAX dates with conditional column filter
I'm not sure the title here best describes my predicament and I'm having trouble finding the right search terms, so forgive me if the solution to this is right under my nose here in the forums. I ...
- 4 years ago
Hi wlandry12
I think your result table is not correct, for example the MAX date for the cost code 165 in the DirectCosts is 25-May-22 and there are 4 lines on ShippingCalendar table for that cost code with dates before 25-May-22.
BTW, try this measure:PaidLoadQty = VAR _Max_Date = CALCULATE ( MAX ( DirectCosts[PaidDate] ), ALLEXCEPT ( DirectCosts, DirectCosts[Cost Code] ) ) RETURN CALCULATE ( COUNTROWS ( ShippingCalendar ), ShippingCalendar[ApprovedDate] <= _Max_Date )Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
ManguilibeKAO
Resolver I
4 years agoHi,
Coud you explain the first line in your output: how do you obtain 4 in the column PaidLoadQty for the costcode 160?
Best regards.
- wlandry124 years agoFrequent Visitor
There are 4 loads with cost code 160 on or before 4/29/22, the maximum date of a paid invoice for that cost code on the DirectCosts table.