Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
minhthu1012
Frequent Visitor

Need Help for showing Weight Completion Percentage

Hi everyone, I have a question related to showing weight completion percentage VS completion percentage in stacked bar chart

Please see this example table below:
- The weight for workstream respectively: PII: 24%, Access: 1%, Migration: 5% and Ingestion: 70%

- 4 unique environment values, in each environment they has 4 unique workstream: PII, Access, Migration, Ingestion

- In each workstream, there are number of schemas

minhthu1012_0-1703193420808.png

 

Requirement:
I have 2 slicers: Environment and Workstream. I want to build a stacked bar chart showing all schema in y-axis

In this visual, I want to show: If I select "all" workstream slicer, the value should show Completion Percentage of each schema in every environment 

While If I select only ONE workstream in slicer, the value should show Weight Completion Percentage of each schema in every environment


Expected Result:

when I select "PI" in workstream slicer for "GC" environment, the schema "i_igh" should return 100% (column completion percentage) but if I select all in workstream slicer for "GC" environment, the schema "i_igh" return 24% (column weight completion percentage) because for schema i_igh "PI" done their work 100% but in total "i_igh" actually just finished 24% at all process

 

I appreciate if someone can show any suggestion on it to resolve!

1 ACCEPTED SOLUTION
v-xuxinyi-msft
Community Support
Community Support

Hi @minhthu1012

Please try the following steps:

1. Create a calculated table.

Workstream = UNION(VALUES('Table'[Workstream]),ROW("Workstream", "All"))

vxuxinyimsft_0-1703581913953.png

 

2. Create two measures as shown below.

Measure = 
IF(
    OR(SELECTEDVALUE(Workstream[Workstream]) = "All", SELECTEDVALUE(Workstream[Workstream]) = BLANK()),
    1,
    IF(
        SELECTEDVALUE(Workstream[Workstream]) = SELECTEDVALUE('Table'[Workstream]), 
        1, 
        0)
)

 

Measure 2 = 
VAR _N1 = CALCULATE(SUM('Table'[Completion percentage]), FILTER(ALLEXCEPT('Table', 'Table'[Environment], 'Table'[Schema]), [Workstream] = SELECTEDVALUE(Workstream[Workstream])))
VAR _N2 = SUM('Table'[Weight Completion Percentage])
RETURN
IF(OR(SELECTEDVALUE(Workstream[Workstream]) = "All", SELECTEDVALUE(Workstream[Workstream]) = BLANK()), _N2, _N1)

 

3. Put the measure into the filter so that the visual only shows data where the measure is equal to 1.

vxuxinyimsft_2-1703582208428.png

 

vxuxinyimsft_1-1703582163938.png

 

vxuxinyimsft_3-1703582244352.png

Is this the result you expect?

Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
v-xuxinyi-msft
Community Support
Community Support

Hi @minhthu1012

Please try the following steps:

1. Create a calculated table.

Workstream = UNION(VALUES('Table'[Workstream]),ROW("Workstream", "All"))

vxuxinyimsft_0-1703581913953.png

 

2. Create two measures as shown below.

Measure = 
IF(
    OR(SELECTEDVALUE(Workstream[Workstream]) = "All", SELECTEDVALUE(Workstream[Workstream]) = BLANK()),
    1,
    IF(
        SELECTEDVALUE(Workstream[Workstream]) = SELECTEDVALUE('Table'[Workstream]), 
        1, 
        0)
)

 

Measure 2 = 
VAR _N1 = CALCULATE(SUM('Table'[Completion percentage]), FILTER(ALLEXCEPT('Table', 'Table'[Environment], 'Table'[Schema]), [Workstream] = SELECTEDVALUE(Workstream[Workstream])))
VAR _N2 = SUM('Table'[Weight Completion Percentage])
RETURN
IF(OR(SELECTEDVALUE(Workstream[Workstream]) = "All", SELECTEDVALUE(Workstream[Workstream]) = BLANK()), _N2, _N1)

 

3. Put the measure into the filter so that the visual only shows data where the measure is equal to 1.

vxuxinyimsft_2-1703582208428.png

 

vxuxinyimsft_1-1703582163938.png

 

vxuxinyimsft_3-1703582244352.png

Is this the result you expect?

Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

amitchandak
Super User
Super User

@minhthu1012 , check if these measures can help

 

Completion % =
AVERAGE('Table'[Completion Percentage])


Weighted Completion % =
SUMX(
'Table',
'Table'[Completion %] *
SWITCH(
TRUE(),
'Table'[Workstream] = "PII", 0.24,
'Table'[Workstream] = "Access", 0.01,
'Table'[Workstream] = "Migration", 0.05,
'Table'[Workstream] = "Ingestion", 0.70,
0
)
)

 

 

Dynamic Completion =
IF (
HASONEVALUE('Table'[Workstream]),
[Completion Percentage],
[Weighted Completion Percentage]
)

Hi @amitchandak, Thank you for your help
For this measure, the problem is because when we do stacked bar chart, the y-axis is schema and it returns only unique schema but in real data, the schema name appears in every environment and every workstream. 
So if I select one workstream, your measure is good to show as I expected. But when I select ALL workstream, one schema (in 4 workstreams) only returns percentage of aggregation (Is there any way to show maximum weight percentage is 100% in a bar - for 1 schema and each workstream is different color?)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.