user3050392
user3050392

Reputation:

Dax sum all fields with same value

I am using Power BI and i would like to know how to sum all the fields of the same value, and then take the percentage out of the total. For example: I have the following table:

               Computer Name | Manufacturer | Errors
                     Comp1   |      Hp      |   4
                     Comp2   |      Dell    |   2
                     Comp3   |      Hp      |   1
                     Comp4   |      Asus    |   2
                     Comp5   |      Asus    |   2

I would like to create a measure that sums all the errors according to manufacturer, so basically it will sum all of the instances of the same value and return something like this:

                     Manufaturer | Errors | Count comps
                         Asus    |   4    |    2
                         Hp      |   5    |    2
                         Dell    |   2    |    1

And in the end calculate the percentage out of max errors.

The part i cant figure is how to some all the errors for same field value.

Please help me, Thanks!

Upvotes: 0

Views: 507

Answers (1)

alejandro zuleta
alejandro zuleta

Reputation: 14108

This can be done with COUNTROWS() and SUM() functions. Create two measures Count comps and Sum Errors.

Count comps=COUNTROWS(Tabla1)

Sum Errors =SUM(Tabla1[Errors])

In Excel, create a pivot table and call the created measures, like this:

enter image description here

Let me know if this helps.

Upvotes: 1

Related Questions