简体   繁体   English

如何计算 Power BI 中表格视觉对象的两列之间的差异?

[英]How can I calculate the difference between two columns of a table visual in Power BI?

我在 Power BI 中的表格视觉对象

I have these columns in Power BI, how can I calculate the difference between 2022 Q2 and 2022 Q1, and then add that difference as another column in the table (ideally as a percentage)?我在 Power BI 中有这些列,如何计算 2022 Q2 和 2022 Q1 之间的差异,然后将该差异添加为表中的另一列(理想情况下为百分比)?

You need to create a measure.您需要创建一个度量。 There's a Quick Measure for that particular calculation:该特定计算有一个快速测量:

在此处输入图像描述

Creates a measure like创建一个像

SalesAmount QoQ% = 
IF(
    ISFILTERED('FactInternetSales'[OrderDate]),
    ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
    VAR __PREV_QUARTER =
        CALCULATE(
            SUM('FactInternetSales'[SalesAmount]),
            DATEADD('FactInternetSales'[OrderDate].[Date], -1, QUARTER)
        )
    RETURN
        DIVIDE(
            SUM('FactInternetSales'[SalesAmount]) - __PREV_QUARTER,
            __PREV_QUARTER
        )
)

you should create as many measures as you like in order to calculate all the time intelligence calculations that you need.您应该创建尽可能多的度量,以便计算您需要的所有时间智能计算。 Once you have made then, you can transform those values into % from the Format Tab afther choosing the DAX measure that you want to format完成后,您可以在选择要格式化的 DAX 度量后,从“格式”选项卡将这些值转换为 %

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM