cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper I

## letter count

Dear experts, I can't solve the letter count and then calculate their respective percentages of the total:

example:
Column 1
a
a
b
c
c
c

I need through DAX to be able to count to get the following result:
a: 2
b:1
c:3

and later:
a: 33%
b:17%
c: 50%

3 REPLIES 3
Resolver I

Hi @JDU ,

try this to get count:

`count = CALCULATE(COUNTA('Table'[Column 1]),ALLEXCEPT('Table','Table'[Column 1]))`

and to get %:

`% = 'Table'[count] / COUNTROWS('Table')`

You can also combine two formulas into 1.

Regards,

Matej

Helper I

The first equation worked very well, the formula responds well, but the second equation does not, it brings me as a result 100% for each of the characters to count.

Where do you think the mistake might be?

Thanks again!

@MatejZukovic wrote:

Hi @JDU ,

try this to get count:

`count = CALCULATE(COUNTA('Table'[Column 1]),ALLEXCEPT('Table','Table'[Column 1]))`

and to get %:

`% = 'Table'[count] / COUNTROWS('Table')`

You can also combine two formulas into 1.

Regards,

Matej

@MatejZukovic wrote:

Hi @JDU ,

try this to get count:

`count = CALCULATE(COUNTA('Table'[Column 1]),ALLEXCEPT('Table','Table'[Column 1]))`

and to get %:

`% = 'Table'[count] / COUNTROWS('Table')`

You can also combine two formulas into 1.

Regards,

Matej

@MatejZukovic wrote:

Hi @JDU ,

try this to get count:

`count = CALCULATE(COUNTA('Table'[Column 1]),ALLEXCEPT('Table','Table'[Column 1]))`

and to get %:

`% = 'Table'[count] / COUNTROWS('Table')`

You can also combine two formulas into 1.

Regards,

Matej

Resolver I

Hi @JDU ,

previous approach would work when you create column in your backend table.

If you'd like to do the calculation as a measure, try this:

`% = [count]/CALCULATE(COUNTA('Table'[Column 1]), ALL('Table'[Column 1]))`