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
mibu
Microsoft Employee
Microsoft Employee

Stacked Column Chart made up of created column data show timefram values as percentages

Hi Power BI Community,

 

I have a Stacked Column Chart made up of created column data, binary in nature:  data for each line item is either Yes or No.

 

I want to show Yes and No as a percentage of their total count...  for timeframe indicated, either week or month.

 

 

Thoughts on how to get what are now two numbers showing with percentages?

 

Thanks!

mibu

1 ACCEPTED SOLUTION

Hi,

 

The measure should be

 

=CALCULATE(SUM(FactData[Units]),FactData[M/NM]="M")/CALCULATE(SUM(FactData[Units]),ALL(FactData[M/NM]))

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

 

Try this

 

Measure=COUNTROWS(Data)/CALCULATE(COUNTROWS(Data),ALL(Data[Response]))

 

Response is the Name of the column which has Yes/No.  Data is the name of the Table.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur!

 

Meausre looks like:

Measure=COUNTROWS(TableName)/CALCULATE(COUNTROWS(TableName),ALL(TableName[ColumnName]))

I get no errors in the measure...  but output looks as follows...  100% for each (Yes and No), rather than correct percentage of each for timeframe indicated.

 

Note:  Reiterating that data in ColumnName is a custom column, created by Custom column formula...

 

Look forward to your feedback.  Thanks!  mibu

Capture.PNG

Hi,

 

Share the link from where i can download your PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

You may download test file here:

https://www.dropbox.com/sh/0lvrflyn90zrvxv/AACd0m-xGh7sN1Lar3teolZQa?dl=0

 

For example:  First week of Aug 2017...  the percentage, as indicated by red line (Line values = measure MM) should be:  13.6% (24/176).

 

Thanks and best,

mibu

Hi,

 

The measure should be

 

=CALCULATE(SUM(FactData[Units]),FactData[M/NM]="M")/CALCULATE(SUM(FactData[Units]),ALL(FactData[M/NM]))

 

Hope this helps.

 

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur.  Your measure worked beautifully.  Thank you so much!  very best, mibu

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @mibu

Please share some data and expected result, so that I can share a solution with you

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.