March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
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!!
Solved! Go to Solution.
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.
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.
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!
@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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
15 | |
7 | |
6 |
User | Count |
---|---|
33 | |
29 | |
16 | |
13 | |
12 |