带过滤器的总色谱柱百分比

带过滤器的总色谱柱百分比

本文介绍了Power BI DAX-带过滤器的总色谱柱百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Power BI来说相对较新-在某种程度上对总计百分比"逻辑有所帮助,在寻求帮助的过程中过高或过低,并且仅找到了未应用过滤器且我需要在DAX代码中应用过滤器的示例.

I'm relatively new to Power BI - have looked high and low for help with "percent of total" logic in a measure and have found only examples where filters ARE NOT applied and I need to apply filters in the DAX code.

我想出了以下内容,这些内容全都给了我(100%的值,而不是总数的百分比).我想我需要对ALLSELECTED等做一些不同的事情,但是可以使用任何人的想法.顺便说一句,我已经尝试了SUM,SUMX,ALL,ALLEXCEPT,ALLSELECTED等的每种组合.非常感谢您的指导.

I have come up with the following, which gives me all ones (100% values instead of the percentages of the total). I think I need to do something different with the ALLSELECTED, etc., but could use any thoughts that any of you have. BTW, I have tried every combination of SUM, SUMX, ALL, ALLEXCEPT, ALLSELECTED, etc. Many thanks in advance for your guidance.

Mix % =
CALCULATE (
    SUM ( service_line_analysis_unpivot[Value] ),
    service_line_analysis_unpivot[Attribute] = "netrevenue"
)
    / CALCULATE (
        SUMX ( service_line_analysis_unpivot, service_line_analysis_unpivot[Value] ),
        FILTER (
            service_line_analysis_unpivot,
            service_line_analysis_unpivot[Attribute] = "netrevenue"
        ),
        ALLSELECTED ()
    )

推荐答案

如果您希望将切片器/过滤器选择中的所有内容的净收入除以总净收入,那么我认为这就是您想要的:

If you want net revenue divided by total net revenue for everything in your slicer/filter selection, then I think this is what you want:

Mix % =
DIVIDE (
    CALCULATE (
        SUM ( service_line_analysis_unpivot[Value] ),
        service_line_analysis_unpivot[Attribute] = "netrevenue"
    ),
    CALCULATE (
        SUM ( service_line_analysis_unpivot[Value] ),
        service_line_analysis_unpivot[Attribute] = "netrevenue",
        ALLSELECTED ()
    )
)

如果这不正确,那么我们需要查看有关数据表,过滤器和外观的更多详细信息.

If that's not right, then we'll need to see more detail on your data table, filters, and visuals.

这篇关于Power BI DAX-带过滤器的总色谱柱百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 20:08