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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jbrijalba
Helper I
Helper I

Creating a percentage based on the first digit in a number

I am creating a Benford's analysis table based on Journal Entries. I have taken the absolute value for each Amount in the ledger and pulled the first digit from it (named the column First Digit). That part works fine, my calculations start to bog down when I do my percentage calculation. Percentage = Count(First digit)/ CountRow(Table). I put into a bar graph as the value and First Digit as the axis. It looks like a Benford's table but the numbers are off. For instance, the 1 digit has a value of about 1043 the 2 digit is around 800 and so on and so forth. I pulled the count of First Digit onto a table visual and manually divided the row total by the grand total and it is giving the expected correct result. 

 

An ideas why the percentage calculation in Power BI is not working aas expected?

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @jbrijalba 

It works on my side.

Create measures:

count = COUNT(Sheet8[number])

count_all = CALCULATE(COUNTROWS(Sheet8),ALL(Sheet8[number]))

per = [count]/[count_all]

6.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @jbrijalba 

It works on my side.

Create measures:

count = COUNT(Sheet8[number])

count_all = CALCULATE(COUNTROWS(Sheet8),ALL(Sheet8[number]))

per = [count]/[count_all]

6.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I forgot to use the calculate(all) function. Worked for me, I just had to use:

Calulate(Countrows(Table), Filter(All(Table), FirstDigit <>0)).

 

Thank you @v-juanli-msft 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors