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

Power BI:计算列与度量值的选择及佣金计算实现咨询

DAX: Choosing Between Calculated Column and Measure for Commission Calculation

Great question! Let’s break this down clearly to help you decide the right approach for your scenario.

1. Should I use a Calculated Column (New Column) or a Measure?

The choice depends entirely on what you need to do with the commission value in your report:

  • Calculated Columns are computed at data load time and stored directly in your data model, with a value for every row in the table. This is a good fit if you need to:
    • Display the commission amount for individual rows in a table/matrix
    • Use the commission value as a filter or grouping field in your report
    • Work with row-level values in other calculations
  • Measures are computed dynamically at report runtime, based on the current context (like filters, slicers, or the rows/columns in a matrix). This is better if you need to:
    • Show aggregated values (e.g., total commission across all qualifying rows)
    • Have the commission update automatically when users apply filters or interact with the report
    • Avoid storing redundant data in your model (since measures don’t persist values)

For your specific requirement—displaying commission in a table/matrix: If you need to see the commission per qualifying row, a calculated column works perfectly. If you want to show a total or dynamic aggregates, go with a measure.

2. Implementing the Calculation with a Measure

Here are two clean ways to write the measure to match your logic:

Option 1: Filter first, then sum

This approach filters the table to only include rows where both Applicable1 and Applicable2 are "Yes", then calculates the sum of Price * Percentage for those rows:

Commission Measure = 
SUMX(
    FILTER(PriceTable, PriceTable[Applicable1] = "Yes" && PriceTable[Applicable2] = "Yes"),
    PriceTable[Price] * PriceTable[Percentage]
)

Option 2: Iterate and conditionally calculate

This iterates over every row, computes the commission only if the row meets the criteria, then sums all those values:

Commission Measure = 
SUMX(
    PriceTable,
    IF(
        PriceTable[Applicable1] = "Yes" && PriceTable[Applicable2] = "Yes",
        PriceTable[Price] * PriceTable[Percentage],
        0
    )
)

Both options will give you the correct total commission, and they’ll update dynamically as you apply filters to your report.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 10:10:30