Issue Description: When calculating forecast values manually in QuickSight, I encountered a problem with the granularity level affecting the addition of the “cost_covered_till_date” and the “forecast_value_remaining_days” for the month.
Problem Statement: The filter applied to calculate the “forecast_value_remaining_days” is inadvertently affecting the calculation of both the “cost_covered_till_date” and the “forecast_value_remaining_days”, resulting in inaccurate addition.
Description of Current Approach:
- Calculated “forecast_value_remaining_days” based on the run rate of daily cost for the remaining days of the month. This involved:
- Utilizing a date parameter to filter the last 7 days to determine the run rate.
- Multiplying the remaining days by the run rate to obtain forecast values.
calculation used is:
(({ Total Cost Without CSP})/7) * (extract(‘DD’,addDateTime(-1, ‘DD’, addDateTime(1, ‘MM’, truncDate(‘MM’, ${Dateselection2}))))-extract(‘DD’,${Dateselection2}))
It is giving me correct result.
Issue with Current Approach: While calculating the forecast on demand for the entire month (which is the sum of the “cost_covered_till_date” and “forecast_value_remaining_days”), the filter applied to “forecast_value_remaining_days” inadvertently affects the calculation by altering the granularity level.
Calculation using:
sumOver(sumIf({Total Cost with CSP}, Application <= ${Dateselection2} AND Application >= truncDate(‘MM’, ${Dateselection2})), [Application]) + sum((({ Total Cost Without CSP})/7) * (extract(‘DD’,addDateTime(-1, ‘DD’, addDateTime(1, ‘MM’, truncDate(‘MM’, ${Dateselection2}))))-extract(‘DD’,${Dateselection2})))
this calculation is not giving correct answer.
Application is date dimension
Desired Solution: To ensure accuracy in the forecast calculation, I aim to fix the granularity level of both the “cost_covered_till_date” and “forecast_value_remaining_days” to today (from the first day of the month). Please note that I aim to calculate is using calculated field only, I am aware about the AI based solution to get forecast values but my requirement is different.
Request for Assistance: Seeking guidance on how to restructure the query or adjust the calculations to achieve the desired result without the filter affecting the “cost_covered_till_date” and “forecast_value_remaining_days”.