Hi,
I have sales information per district with different filters about certain item classes and branch types within a district. I have margin, sales, and cost per bucket. I would like to find a "best in class" margin number based on a calculation that can filter with said item classes and branch types. This "best in class" margin has the logic of the total margin of the top fourth margin numbers in the company. Intuitively, I would say "if(total margin > percentile(total margin, .75), divide(sum(total sales) - sum(total cost), total sales)". How would i put together this measure correctly with DAX that will filter correctly?