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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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