Here’s a fun one I created a mockup of data so that I can illustrate what I’m trying to do and post the PBIX.
I have 10 stores that sell fruits and vegetables, and I can see their orders aggregated by week. I want to count the number of stores with re-orders. In other words, count the number of stores that ordered the same product again after their initial order, and I want to view this on a cumulative weekly basis.
As you can see in the pbix, my DAX measured are correctly counting the number of stores that placed an order in the 3 week period (9 of 10 stores ordered fruit) However, I can’t get the re-order expression to work. If it worked correctly, it would show that on a cumulative basis, 1 store re-ordered any fruit product in week ending Jan 9 and 6 stores had re-ordered any fruit product in week ending Jan 16th. (see attached picture for illustration)
Here’s the incorrect DAX formula that I tried:
# of Stores with Re-Orders =
calculate(
calculate(distinctcount(Orders[Store#]),
filter(values(StoreList[Store #]), DISTINCTCOUNT(Orders[WeekEndDate])>1) )
, filter(all(Orders[WeekEndDate]), Orders[WeekEndDate] <= MAX( Orders[WeekEndDate] ) ) )