Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help needed - count a value row wise

 

I would like to add the number of N row wise.

How do I do that?

 

Thanks,

Anand

  • Anonymous ,

    I added a column to your original table. No unpivoting.


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

     

     

     

     

    Summary = If(Original[a] = "Y", 1)+If(Original[b] = "Y", 1)+If(Original[c] = "Y", 1)
    
    //just copy and paste the the first IF, and then change the letter on the rest.

     

9 Replies

  • Nathaniel_C's avatar
    Nathaniel_C
    Community Champion

    Anonymous ,

     

     

    My table

     

     

    Go to Power Query and Select the two rows with the names. UnPivot => Other Rows.

     

    Delete the attribute column, return to Power BI and create the measure below where Y_Table is my table, and the Columns are Y_Table[fname],Y_Table[sname]),Y_Table[Value]

     

     

    Count of Y = CALCULATE(COUNTROWS(Y_Table),FILTER(ALLEXCEPT(Y_Table,Y_Table[fname],Y_Table[sname]),Y_Table[Value]="Y"))


    Let me know if you have any questions.

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

    • Nathaniel_C's avatar
      Nathaniel_C
      Community Champion

      Hi Anonymous ,

       

      Yes
      Here is the pbix.


      Let me know if you have any questions.

      If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
      Nathaniel

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for the solution. However I also want to display all the columns. I mean a,b,c,d,e and the count of N.

       

      Kindly help me with that

      • Nathaniel_C's avatar
        Nathaniel_C
        Community Champion

        Anonymous ,

        I added a column to your original table. No unpivoting.


        Let me know if you have any questions.

        If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
        Nathaniel

         

         

         

         

        Summary = If(Original[a] = "Y", 1)+If(Original[b] = "Y", 1)+If(Original[c] = "Y", 1)
        
        //just copy and paste the the first IF, and then change the letter on the rest.