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

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

Reply
Pooja_Mishra
Helper I
Helper I

Power bi desktop

Hi All, 

I have a table in which Column A has some values and I am trying to calculate percentage as shown in below table:

 

Column A
abc
abc
xyz
xyz
abc
abc

 

Percentage
abcxyz
66.66%33.33%

 

 

Is there any query that can give me the percentage as shown above?

 

 

 

 

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

Hi @Pooja_Mishra 

(1)Create a column to count the number of category .

column A num = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Column A]))

(2)Create a column to count the number of the table

whole num = COUNTROWS('Table')

(3)Create a column to count the percentage

percentage = 'Table'[column A num]/'Table'[whole num]

Ailsamsft_0-1628820326224.png

Then add a Matrix visual and put Column A into Columns ,put percentage into Values .

The final result is as shown :

Ailsamsft_1-1628820326225.png

Ailsamsft_2-1628820326227.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

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-yetao1-msft
Community Support
Community Support

Hi @Pooja_Mishra 

(1)Create a column to count the number of category .

column A num = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Column A]))

(2)Create a column to count the number of the table

whole num = COUNTROWS('Table')

(3)Create a column to count the percentage

percentage = 'Table'[column A num]/'Table'[whole num]

Ailsamsft_0-1628820326224.png

Then add a Matrix visual and put Column A into Columns ,put percentage into Values .

The final result is as shown :

Ailsamsft_1-1628820326225.png

Ailsamsft_2-1628820326227.png

I have attached my pbix file ,you can refer to it .

 

Best Regards

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Pooja_Mishra , Create a measure like

percent = divide( countrows(Table), calculate( countrows(Table), allselected(Table)))

// mark as % in measure tool

 

 

In matrix , Enable  : Show on row

Use column on Column of matrix. Nothing on row

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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