Forum Discussion
Calculate average distinctcount with variable duration in the last 12 months
orders amount depending on duration = CALCULATE(DISTINCTCOUNT(sales[order number],
DATESBETWEEN( 'Date'[Date], DATE( YEAR(TODAY()) - 1, MONTH(TODAY()), DAY(TODAY()), TODAY()) )Hi johnt75 thank you for your prompt help.
Won't that calculate all rows in between date instead of calculate average rows per payment terms in days?
- johnt754 years ago
Super User
I think I have misunderstood what you are trying to do. Can you clarify please
- Noelle4 years ago
Helper I
Let's say I have customerA, ordering 128 times in the last 12 months, payment term is 30 days. He orders 8 times per month, but one month he ordered 40 times. The average amount of orders during 30 days is not 128/12 (if we consider one month=30 days) It'll be more around 8 then. + the payment term "30 days) will be different according to each customer.
- Noelle4 years ago
Helper I
I think I need to create a loop where, every day between today and 12 months ago, PBI will calculate amount of orders on the said duration (in my example above 30 days) and will return the average of those calculations.