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
Typhoon74
Helper I
Helper I

Calculate percentage of specific status out of several

Hi everyone,

I am starting with power bi desktop and stucking finding a solution for the following senario.

I do have a list of items having a status per department.

On a Matrix I would like to add a column showing the % open by department calculated by the SUM of Status '07 Finished' and '08 Report Ready' divided by the sum of status 07, 08, 09 and 12.

A excel file with sample data can be looked at here 

 

Typhoon74_3-1640609153857.png

 

The Result Matrix should look like this showing all status columns showing the numbers and the new column showing the percentage open.

Typhoon74_4-1640609379932.png

 

Thanks in advance for all your helpful suggestions and many greetings

Dirk

 

2 ACCEPTED SOLUTIONS
v-zhangti
Community Support
Community Support

Hi, @Typhoon74 

 

You can try the following methods.

%Open = 
VAR N1 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "07 Finished" )
    )
VAR N2 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "08 Report Ready" )
    )
VAR N3 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "09 Written" )
    )
VAR N4 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "12 Archived" )
    )
RETURN
    DIVIDE ( N1 + N2, N1 + N2 + N3 + N4 )

vzhangti_0-1640848079659.png

 

Best Regards,

Community Support Team _Charlotte

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

Typhoon74
Helper I
Helper I

Finally I got my visual created with the help of @v-zhangti reply and other ideas I found out in this community.

Typhoon74_2-1641211223523.png

 

I build my visual with measures 

  1. I created a measure to count the Qty per each Status
    Typhoon74_1-1641211070182.png
  2. For the Total STATUS I am using the measure
    Typhoon74_3-1641211479618.png
  3. And for Open %, I used the solution provided by v-zhangti

View solution in original post

7 REPLIES 7
Typhoon74
Helper I
Helper I

Finally I got my visual created with the help of @v-zhangti reply and other ideas I found out in this community.

Typhoon74_2-1641211223523.png

 

I build my visual with measures 

  1. I created a measure to count the Qty per each Status
    Typhoon74_1-1641211070182.png
  2. For the Total STATUS I am using the measure
    Typhoon74_3-1641211479618.png
  3. And for Open %, I used the solution provided by v-zhangti
v-zhangti
Community Support
Community Support

Hi, @Typhoon74 

 

You can try the following methods.

%Open = 
VAR N1 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "07 Finished" )
    )
VAR N2 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "08 Report Ready" )
    )
VAR N3 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "09 Written" )
    )
VAR N4 =
    CALCULATE (
        COUNT ( 'Table'[STATUS] ),
        FILTER ( 'Table', [STATUS] = "12 Archived" )
    )
RETURN
    DIVIDE ( N1 + N2, N1 + N2 + N3 + N4 )

vzhangti_0-1640848079659.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rbriga
Impactful Individual
Impactful Individual

Let's try:

Open%=
VAR _Finished = CALCULATE(COUNTROWS(Table), KEEPFILTERS (Table[Status] = "07 Finished")
VAR _Ready = CALCULATE(COUNTROWS(Table), KEEPFILTERS (Table[Status] = "08 Report Ready")
VAR _Written= CALCULATE(COUNTROWS(Table), KEEPFILTERS (Table[Status] = "09 Written")
VAR _Archived= CALCULATE(COUNTROWS(Table), KEEPFILTERS (Table[Status] = "12 Archived")
Return
DIVIDE(_Finished+_Ready , _Finished + _Ready +_Written+_Archived)

Does it help?

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!

@rbriga  It is giving me a error message

"Wrong Syntax for "Return" any idea or suggestion what to do?

Typhoon74_0-1640612501304.png

 

rbriga
Impactful Individual
Impactful Individual

Remove the commas at the end of each VAR

-------------------------
Data analyst by day, hockey goalie by night.
Did I help? Then please hit that "kudos" or "accept as a solution" button!
amitchandak
Super User
Super User

@Typhoon74 , You can get open % like

divide(countrows(filter(allselected(Table), Table[Deaprtment] = max(Table[Deaprtment]) && table[Status] in{"07 Finished","08 Report Ready"})),countrows(filter(allselected(Table), Table[Deaprtment] = max(Table[Deaprtment]) && table[Status] in{"07 Finished","08 Report Ready","09 Written","12 Archived"})) )

 

But you will not get that display

 

if you are looking for a Hybrid display with Matrix Column and measure
https://community.powerbi.com/t5/Community-Blog/Creating-a-custom-or-hybrid-matrix-in-PowerBI/ba-p/1...
https://community.powerbi.com/t5/Quick-Measures-Gallery/The-New-Hotness-Custom-Matrix-Hierarchy/m-p/...

vote for Hybrid Table
https://ideas.powerbi.com/ideas/idea/?ideaid=9bc32b23-1eb1-4e74-8b34-349887b37ebc

Thanks amitchandak, it provides me a table showing the percentage by department. Will vore for the option of hybrid tables 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.