计算各组占总数的百分比

Calculate the percentage of the groups compared to the total

我有以下架构:

我正在使用与此 SSAS 表格多维数据集的实时连接,我想计算状态 = 可用的产品的百分比

每个产品与 Status=Available 的产品总数相比。

类似于:

% Products Available = 

VAR NumProductsAvailable = 
    CALCULATE ( 
        DISTINCTCOUNT ( FactTable[ProductSK] ),
        Status[Status] = "Available"
    )

VAR NumProducts = 
    DISTINCTCOUNT ( FactTable[ProductSK] )

RETURN
    DIVIDE ( 
        NumProductsAvailable,
        NumProducts
    )