Excel Dax 简明教程
Updating the Results of DAX Formulas
DAX 公式用于涉及海量数据(包括来自外部数据源的数据)的计算中。此类数据会因 DAX 计算针对实时数据而时常发生改变。
DAX formulas are used in calculations involving large data, including data from external data sources. The data can be subjected to changes from time to time as the DAX calculations are meant for live data as well.
在以下两种情况下,需要更新 DAX 公式的结果:
The results of DAX formulas need to get updated on two occasions −
-
Data Refresh − When the data is refreshed.
-
Recalculation − When there are changes in the DAX formula.
Understanding Data Refresh vs. Recalculation
数据刷新和重新计算是两个独立,但相互关联的操作。
Data refresh and recalculation are two separate but related operations.
-
Data refresh is the process of updating the data in the Data Model in your workbook obtaining up-to-date data from external data sources.
-
Recalculation is the process of updating all the columns, tables, and PivotTables in your workbook that contain DAX formulas, to reflect the changes in the underlying data that result from the changes to DAX formulas themselves.
在其中的 DAX 公式未重新计算之前,不应保存或发布工作簿。
You should not save or publish the workbook until the DAX formulas in it have been recalculated.
Different Ways to Update Data in Data Model
Power Pivot 不会自动检测外部数据源中的更改。
Power Pivot does not automatically detect changes in external data sources.
-
You can refresh data manually from the Power Pivot window at intervals that you can specify.
-
You can schedule an automatic data refresh from external sources, if you have published the workbook to a SharePoint site.
有关这些内容的详细信息,请参阅章节 Updating Data in Data Model 。
For details on these, refer to the chapter – Updating Data in Data Model.
Recalculation of DAX Formulas
DAX 公式的重新计算是一项重要任务,因为在重新计算期间,会检查列依赖关系,如果没有列已更改、数据无效,或者过去可以正常工作的 DAX 公式中出现错误,系统会通知您。
Recalculation of a DAX formula is an important task, because during recalculation, column dependencies are checked and you will be notified if a column has changed, if the data is invalid, or if an error has appeared in a DAX formula that used to work.
重新计算可能会通过以下方式影响性能:
Recalculation can affect performance in the following ways −
-
For a calculated column, the result of DAX formula should always be recalculated for the entire column, whenever you change the DAX formula.
-
For a calculated field, the result of DAX formula is not calculated until the calculated field is placed in the context of a PivotTable or a PivotChart. The DAX formula will be recalculated when you change any row or column heading that affects the filters on the data or when you manually refresh the PivotTable.
在 DAX 中,重新计算公式可以自动或手动完成。
In DAX, recalculating formulas can be done automatically or manually.
要了解有关重新计算的更多信息,请参阅章节—— Recalculating DAX Formulas 。
To learn more about recalculation, refer to the chapter – Recalculating DAX Formulas.