Forum Discussion

Samcooke's avatar
Samcooke
Frequent Visitor
2 years ago
Solved

Need Help with Filtering to Max Date

Hi all, I am struggling with something that I thought would be easy but apparently not for me. I have a table of orders that have the product and the ship date for easch product. Some of the orders h...
  • Samcooke's avatar
    Samcooke
    2 years ago

    Thanks for your feedback. I ended up using the below query I found somewhere else and replaced the table and fields with mine. It worked. I had never used "Filter" in a query before

    MaxOfMonth = IF(
    	Table1[date] = CALCULATE(
    		MAX(TableName[date]),
    		FILTER(
    			ALL(TableName),
    			MONTH(TableName[date]) = MONTH(EARLIER(TableName[date])) &&
    			YEAR(TableName[date]) = YEAR(EARLIER(TableName[date]))
    		)
    	),
    	TRUE,
    	FALSE
    )