简体   繁体   中英

Count based on two sub groups in Power Bi

I have Data as in following table, I want to show the % of work order count over the year for each group in stacked area chart but I am struggling to get the correct %. From the below data the % of each Days Delayed group should come as 50%

在此处输入图片说明

Appreciate any helps.

First, create this below Measure -

group_wsie_percentage = 

VAR total_count = 
CALCULATE(
    COUNT(your_table_name[days delayed group]),
    ALLEXCEPT(
        your_table_name, 
        your_table_name[year]
    )
)

VAR total_group_count = 
CALCULATE(
    COUNT(your_table_name[days delayed group]),
    ALLEXCEPT(
        your_table_name, 
        your_table_name[year],
        your_table_name[days delayed group]
    )
)

RETURN total_group_count/total_count

Now change the type of measure as % and configure your Stacked (I used Stacked Bar chart) chart as below-

在此处输入图片说明

Here is the output-

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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