Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Sum all comtens in multiple columns

Hi everyone im new in powerbi and Dax funtions
I trying to merge or sum all contents in multiple columns the divide from total of participants all the participants has multiple answers
Like the next image in excel using count.if and counta funtions


y try with the next messure: 

Dog = var DOGS = COUNTROWS(FILTER(Pets,Pets[Pet1] = "Dog")) +
COUNTROWS(FILTER(Pets,Pets[Pet2] = "Dog")) +
COUNTROWS(FILTER(Pets,Pets[Pet3] = "Dog")) +
COUNTROWS(FILTER(Pets,Pets[Pet4] = "Dog")) +
COUNTROWS(FILTER(Pets,Pets[Pet5] = "Dog")) +
COUNTROWS(FILTER(Pets,Pets[Pet6] = "Dog"))

Var totalPets = COUNTA(Pets[Participants])
return DIVIDE(DOGS,totalPets)

But this only work for "Dog" then made multiple measure for all the pets in my table and i couldn't graph all the measures in the same graph, there is a better? 

And tnx for the help

Hector Escalante
  • Anonymous 

    You can unpivot the table in Power Query and the rest is easy. Please find attached the Power BI file below my signatire.

     

  • Anonymous , first of all, you might want to try transforming the dataset into a flat table,

    then, you can author different measures to conduct different analyses.

5 Replies

  • Anonymous 

    You can unpivot the table in Power Query and the rest is easy. Please find attached the Power BI file below my signatire.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Works! ty but change my other messures and change my other data analysis, can you check my replay! pliz

  • CNENFRNL's avatar
    CNENFRNL
    Community Champion

    Anonymous , first of all, you might want to try transforming the dataset into a flat table,

    then, you can author different measures to conduct different analyses.

    • Anonymous's avatar
      Anonymous
      Not applicable

      I try to un pivot column but change my other messures can you check my replay pliz

  • Anonymous's avatar
    Anonymous
    Not applicable

    I try to upload my pbi file but i cant, unpivot my columns makes me error with other graphs and messure, let you below in the image and the data i use, and ty again everyone.