Forum Discussion

sprasad's avatar
sprasad
Helper II
7 years ago
Solved

Working with Custom Column

Hi,

 

1. I am trying to prepare a bug metrics to check the %age of bug has been fixed till now:

 

%age of Bug fixed is = Total no of Bugs in Closed State/ (Total bugs in Closed State+Total bugs in New State + Total bugs in Active State) * 100.

Below is the table which represents the data. I want to poulate the Custom column with the values using the above formula. How can I do this?

 

ProjectStateCountIssuesCustom
AClosed525525/526
ANew1525/526
BClosed1280
BUClosed1313/20
BUNew713/20
GClosed40
MNew6167/173
MClosed1670
NNew245/(29)
NClosed55/(29)
PNew436/36
PClosed3236/36
RActive11421/440
RNew8421/440
RClosed421421/440

 

How can Iuse the filter on State column in Custom column dialog so that I can filter the records based on State[new]+State[Active] etc?

 

TIA



  • sprasad  After performing the steps posted above, then create a new table as below

     

    Test187Final = SUMMARIZE(Test187,Test187[Project],"Custom",MAX(Test187[Custom]))

5 Replies

  • PattemManohar's avatar
    PattemManohar
    Community Champion

    sprasad  Please try this as a new column in Modeling tab (DAX) instead of Power Query Editor.

     

    Custom = 
    VAR _ClosedProjectSum = CALCULATE(SUM(Test187[CountIssues]),FILTER(ALL(Test187),Test187[State]="Closed" && Test187[Project] = EARLIER(Test187[Project])))
    VAR _AllProjectSum = CALCULATE(SUM(Test187[CountIssues]),FILTER(ALL(Test187),Test187[Project] = EARLIER(Test187[Project])))
    RETURN (_ClosedProjectSum/_AllProjectSum ) * 100

     

     

    • Zubair_Muhammad's avatar
      Zubair_Muhammad
      Community Champion

      sprasad 

       

      As a custom Column, you can use this

       

      Please see attached file's query editor

       

      ChangedType is the name of previous step

      =let  myproject=[Project]
            in
      let 
      mystates=Table.SelectRows(ChangedType, each [Project]=myproject)[State],
      
      numerator=Table.SelectRows(ChangedType, each [Project]=myproject and [State]="Closed")[CountIssues],
      
      denominator=Table.SelectRows(ChangedType, each [Project]=myproject)[CountIssues] 
      
      in
      
      if List.Contains(mystates,"New") then List.Sum(numerator)/List.Sum(denominator) else 0
      • sprasad's avatar
        sprasad
        Helper II

        Hi Zubair,

        Thanks for your help, Actually i couln't work through your code. where can i get the references or help of the code you worte?

         

        Thanks

        Sudhir

    • sprasad's avatar
      sprasad
      Helper II

      Thanks Manohar, It is working correctly. Can we display the %age calculated in Custom column in a single row for each project? 

      • PattemManohar's avatar
        PattemManohar
        Community Champion

        sprasad  After performing the steps posted above, then create a new table as below

         

        Test187Final = SUMMARIZE(Test187,Test187[Project],"Custom",MAX(Test187[Custom]))