Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
JDU
Helper I
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%

please your help!

3 REPLIES 3
MatejZukovic
Resolver I
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

 

 

First of all thank you very much for your reply @MatejZukovic 

 

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

 

 


 

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]))

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.