Forum Discussion
Return date when running total target is hit
Hi,
Is it possible to return date when running total hit a specific target? F.ex. I would like to check the threshold within 2 weeks ahead and see if the target is below certain value.
My dax which return running total looks something like this
Hi gyeea84 ,
I know that your [current capacity], [total out] and [total in] are all measures, but I can't reproduce your model, so I can only use fact columns instead.
Please refer to the formula below.Estimated remaining capacity = VAR sum_out = SUMX( FILTER( ALLSELECTED(Sheet2), [Date] <= MAX([Date]) ), [Total Out] ) VAR sum_in = SUMX( FILTER( ALLSELECTED(Sheet2), [Date] <= MAX([Date]) ), [Total In] ) RETURN [current capacity] + sum_out - sum_inBest regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- lbendlin
Super User
Create a measure where you have a table variable with all dates in your window, then calculate the running total for each of the dates, and then find the minimum date that has the running total above your threshold.
Use variables along the way, and use CONCATENATEX() to verify that you get the expected intermediate results.
- v-lionel-msft
Community Support
Hi gyeea84 ,
Please show us the sample data and the expected output result.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- gyeea84Regular Visitor
Hi,
This is the example of the report. This report will estimate the available capacity in warehouse based on total pallet coming in and going out in daily basis.
Total in + out = data come from different tables and use measure to calculate
Current capacity = data come from a table and use measure to calculate
Estimated remaining capacity = current capacity + total out - total in. This is the running total measure because I need to accumulate the total based on daily basis. F.ex. today is 30.10, current capacity is 2066, total in is 841, total out is 1133, so estimated remaining capacity = 2066+1133-841=2358. The next day, 31.10, current capacity which is remaining capacity for today 2358, total in 55, total out 18, so 2358+18-55=2321, and calculation continue. The measure of this running total is on the original post.
My main goal is to return a date where the estimated remaining capacity hit, f.ex., 2000.
- v-lionel-msft
Community Support
Hi gyeea84 ,
I know that your [current capacity], [total out] and [total in] are all measures, but I can't reproduce your model, so I can only use fact columns instead.
Please refer to the formula below.Estimated remaining capacity = VAR sum_out = SUMX( FILTER( ALLSELECTED(Sheet2), [Date] <= MAX([Date]) ), [Total Out] ) VAR sum_in = SUMX( FILTER( ALLSELECTED(Sheet2), [Date] <= MAX([Date]) ), [Total In] ) RETURN [current capacity] + sum_out - sum_inBest regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.