You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

DAX/Power Pivot:基于累计总成本计算75%支出日期及EAC问题咨询

Got it, let's walk through how to figure out that 75% spend date at the Account level, using your EAC-filtered cost tables. Here's a step-by-step approach tailored to your setup:

Step 1: Lock in Consistent Date & Account Granularity

First off, make sure all three of your cost tables (Forecasted Cost, Actual Costs, Invoiced Costs) have consistent Account and Date columns. For example, Forecasted should have a forecast date, Actual an actual spend date, and Invoiced an invoice date. If any table is missing dates, you'll need to fill those in—dates are critical for tracking cumulative spend over time. Also, confirm the EAC Filter column is applied at the right level (whether per Account+Date or just per Account) since that will affect our filtering logic later.

Step 2: Create a Combined EAC-Filtered Cost Table

We’ll start by merging all three tables into one, but only include rows where EAC Filter is set to "Y". This simplifies our cumulative calculations later. Use this DAX formula to create a calculated table:

EAC_Combined_Costs = 
// Union all three cost tables with standardized columns
VAR CombinedRaw = 
    UNION(
        SELECTCOLUMNS(Forecasted_Cost, 
            "Account", Forecasted_Cost[Account],
            "Cost_Date", Forecasted_Cost[Forecast_Date],
            "Cost_Amount", Forecasted_Cost[Cost],
            "EAC_Filter", Forecasted_Cost[EAC Filter]
        ),
        SELECTCOLUMNS(Actual_Costs, 
            "Account", Actual_Costs[Account],
            "Cost_Date", Actual_Costs[Actual_Date],
            "Cost_Amount", Actual_Costs[Cost],
            "EAC_Filter", Actual_Costs[EAC Filter]
        ),
        SELECTCOLUMNS(Invoiced_Costs, 
            "Account", Invoiced_Costs[Account],
            "Cost_Date", Invoiced_Costs[Invoice_Date],
            "Cost_Amount", Invoiced_Costs[Cost],
            "EAC_Filter", Invoiced_Costs[EAC Filter]
        )
    )
// Filter only rows where EAC Filter is "Y"
RETURN FILTER(CombinedRaw, CombinedRaw[EAC_Filter] = "Y")

Quick note: If your EAC Filter is only set per Account (not per Account+Date), you can adjust the filter to check the Account's status directly instead of bringing the filter into the union.

Step 3: Calculate Cumulative EAC Cost per Account & Date

Next, create a measure to track the running total of costs for each Account, ordered by date. This will show us how much has been spent (or forecasted/invoiced) up to each date:

Cumulative_EAC_Cost = 
CALCULATE(
    SUM(EAC_Combined_Costs[Cost_Amount]),
    // Keep all dates up to the current date in the filter context
    FILTER(
        ALLSELECTED(EAC_Combined_Costs[Cost_Date]),
        EAC_Combined_Costs[Cost_Date] <= MAX(EAC_Combined_Costs[Cost_Date])
    ),
    // Keep the current Account fixed
    ALLEXCEPT(EAC_Combined_Costs, EAC_Combined_Costs[Account])
)
Step 4: Compute Total EAC Cost for Each Account

We need the full total EAC cost to find our 75% threshold. This measure gives us the sum of all EAC-eligible costs per Account:

Total_EAC_Cost = 
CALCULATE(
    SUM(EAC_Combined_Costs[Cost_Amount]),
    ALLEXCEPT(EAC_Combined_Costs, EAC_Combined_Costs[Account])
)
Step 5: Find the 75% Spend Date

Finally, this measure will return the earliest date where the cumulative cost reaches or exceeds 75% of the total EAC cost for the Account:

75%_Spend_Date = 
VAR Target_Threshold = [Total_EAC_Cost] * 0.75
// Create a table of dates with their corresponding cumulative costs
VAR Cumulative_Date_Table = 
    ADDCOLUMNS(
        VALUES(EAC_Combined_Costs[Cost_Date]),
        "Running_Total", [Cumulative_EAC_Cost]
    )
// Filter dates where cumulative cost meets or exceeds the 75% threshold
VAR Eligible_Dates = 
    FILTER(Cumulative_Date_Table, [Running_Total] >= Target_Threshold)
// Return the earliest eligible date, or blank if threshold isn't met
RETURN
    IF(
        NOT ISBLANK(Target_Threshold) && COUNTROWS(Eligible_Dates) > 0,
        MINX(Eligible_Dates, EAC_Combined_Costs[Cost_Date]),
        BLANK()
    )
Key Things to Keep in Mind
  • Date Formatting: Double-check that your Cost_Date column is formatted as a date type (not text) so the ordering works correctly—this ensures we get the earliest possible date for the 75% threshold.
  • Dynamic EAC Updates: Since your EAC Filter column changes automatically, all these measures will refresh dynamically too. No manual updates needed as data or filter values change.
  • Budget Comparison: If you want to compare this 75% date to your Account-level budget, you can create a similar cumulative budget measure and cross-reference the two dates to track variance.

内容的提问来源于stack exchange,提问作者Brian

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:29:43