cancel
Showing results for
Did you mean: Frequent Visitor

## percentage along x-axis

Hi everyone.

I have two columns: I want a bar chart whit  the percentage of notes related to the number of students. ej: "50% of the id_alumno have note =8"

If we see now , my bar chart is a count of id_alumno with a note: What is the measure that i need?

Tanks!!

1 ACCEPTED SOLUTION  Resolver I

Hi,

there are several possibilities.
To illustrate them, I created some sample data (and added another column for a class or course).
Table "Notes": I see three options:

1. Maybe another visual is already what you need
If you choose a stacked column chart (100%), it already shows you the percentages - but all in one column. (Put the "notes" in Legend and the Quick-Measure "number of notes" in Values). You could also put the column "clase" in the Axis, then you get one column per class. 2. Measure for percentage comparison with total number
If you want to have columns next to each other, you can use the following measure:

Percentage of notes =

DIVIDE (

COUNTROWS(Notes),

CALCULATE(

COUNTROWS(Notes),

REMOVEFILTERS(Notes)

)

)

With this, the visualizations above but also the following visualization is possible: But if you add the classes (in the Legend), the result might not be what you want: As you can see, the percentage is calculated to the total number of notes (rows), not to the total number of notes of the specific class.

Therefore, the third solution comes into play:

3. Measure for percentage comparison with subsets
In the previous measure, the filtered number of rows is always compared with the total number. But sometimes you want to compare only with a subset, e.g. with the total number within the class:
In that case you would have to adjust the measure and remove only the filter on the "notes" column:

Percentage of notes compared to subsets =

DIVIDE (

COUNTROWS(Notes),

CALCULATE(

COUNTROWS(Notes),

REMOVEFILTERS(Notes[notes])

)

)

Now, you can show the following with percentages relative to each class: I hope this helps.

3 REPLIES 3  Resolver I

Hi,

there are several possibilities.
To illustrate them, I created some sample data (and added another column for a class or course).
Table "Notes": I see three options:

1. Maybe another visual is already what you need
If you choose a stacked column chart (100%), it already shows you the percentages - but all in one column. (Put the "notes" in Legend and the Quick-Measure "number of notes" in Values). You could also put the column "clase" in the Axis, then you get one column per class. 2. Measure for percentage comparison with total number
If you want to have columns next to each other, you can use the following measure:

Percentage of notes =

DIVIDE (

COUNTROWS(Notes),

CALCULATE(

COUNTROWS(Notes),

REMOVEFILTERS(Notes)

)

)

With this, the visualizations above but also the following visualization is possible: But if you add the classes (in the Legend), the result might not be what you want: As you can see, the percentage is calculated to the total number of notes (rows), not to the total number of notes of the specific class.

Therefore, the third solution comes into play:

3. Measure for percentage comparison with subsets
In the previous measure, the filtered number of rows is always compared with the total number. But sometimes you want to compare only with a subset, e.g. with the total number within the class:
In that case you would have to adjust the measure and remove only the filter on the "notes" column:

Percentage of notes compared to subsets =

DIVIDE (

COUNTROWS(Notes),

CALCULATE(

COUNTROWS(Notes),

REMOVEFILTERS(Notes[notes])

)

)

Now, you can show the following with percentages relative to each class: I hope this helps.  Super User

Hi,

You did specify you wanted a bar chart, but typically when displaying this kind of data I would use a combo chart. So keep the bars as they are and use a line to display the percentages. This way you get the same information, but you don't have to deal with bucketing and overly complicated dax. For the line measure somethin like this ought to do: DIVIDE(COUNT(table[Notes]),CALCULATE(COUNT(Table[Notes]),ALL(Table))))

Proud to be a Super User!  Super User

@Dgpte , Not very create. But you need to use binning or bucketing.

In your case, you might have to create a table with a range of each 1 %

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...

Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

Learn Power BI - Full Course with Dec-2022, with new DAX functions like Window, Index, Offset !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Formatted Profit and Loss Statement with empty lines Announcements #### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023. #### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers! #### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture. Top Solution Authors
Top Kudoed Authors
Users online (4,950)