Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Steph74
Contributor III
Contributor III

Histogramme avec les ordonnées en %

Bonjour,

Une question.. qui me semble bête mais je n'arrive pas à mettre les ordonnées en pourcentage sur un histogramme. J'ai aujourd'hui le nombre d'occurrence par classe. Est-ce quelqu'un aurait l'option cachée et/ou la méthode?

Merci par avance

Steph74_0-1732179710759.png

 

Labels (1)
1 Solution

Accepted Solutions
diegozecchini
Specialist
Specialist

Hi!
It sounds like you're on the right track with your formula, but the issue might be due to how Qlik handles dimensions in combination with your calculated measure. Here's how you can troubleshoot and resolve this

Ensure the dimension you are using for binning (e.g., VehKmPeriode) is correctly defined.
If VehKmPeriode represents continuous data (like numeric values), you may need to group it into bins using a function like Class().
Example:
Class(VehKmPeriode, 50) // Groups values into intervals of 50

Then use the updated dimension (e.g., Class(VehKmPeriode, 50)) in your measure formula. Here's how your formula should look:


(Count(VehKmPeriode) / Count(TOTAL VehKmPeriode)) * 100
This ensures that the percentage is calculated for each bin relative to the total.

View solution in original post

5 Replies
diegozecchini
Specialist
Specialist

Hi!

Instead of using the count of occurrences as the measure, calculate the percentage for each bin.
Use an expression like:

(Count(Dimension) / Count(TOTAL Dimension)) * 100
Replace Dimension with the name of your field. This formula calculates the percentage of occurrences in each bin relative to the total.

Then to adjust Y-Axis settings:
Open the "Appearance" settings of the chart.
Go to the Y-Axis section and ensure the range reflects percentages (e.g., 0 to 100).

finally format the Y-Axis In the "Number Format" section, set the format to Number with a suffix of % or use the Percentage format directly.

Steph74
Contributor III
Contributor III
Author

Hello,

Merci de ta réponse

J'avais imaginé qu'il y avait une petite case à cocher ;-).

J'avais essayé ce type de formule : 

-(Count(VehKmPeriode)/Count(total VehKmPeriode))*100

Mais malgré que la formule soit bonne, lors de l'affichage, il m'indique que la dimension n'est pas bonne.

Steph74_0-1732183633301.png

 

diegozecchini
Specialist
Specialist

Hi!
It sounds like you're on the right track with your formula, but the issue might be due to how Qlik handles dimensions in combination with your calculated measure. Here's how you can troubleshoot and resolve this

Ensure the dimension you are using for binning (e.g., VehKmPeriode) is correctly defined.
If VehKmPeriode represents continuous data (like numeric values), you may need to group it into bins using a function like Class().
Example:
Class(VehKmPeriode, 50) // Groups values into intervals of 50

Then use the updated dimension (e.g., Class(VehKmPeriode, 50)) in your measure formula. Here's how your formula should look:


(Count(VehKmPeriode) / Count(TOTAL VehKmPeriode)) * 100
This ensures that the percentage is calculated for each bin relative to the total.

Steph74
Contributor III
Contributor III
Author

Merci beaucoup,

Du coup j'avais exploré cette piste qui est concluante. 

Je mets la fonction class dans le chargement de mes données pour créer un nouveau champ. Au lieu de prendre la visualisation Histogramme, je prends le graphique en barre avec ma nouvelle dimension issue de class et ma mesure  VehKmPeriode. 

Dommage que cela ne soit pas pas natif à l'histogramme. 

Encore merci

diegozecchini
Specialist
Specialist

You're absolutely right—Qlik's histogram visualization doesn't natively support this kind of customization, and adding a percentage y-axis requires workarounds like creating new fields or using bar charts instead. This approach is indeed robust and gives you more flexibility in defining bins and ensuring the measure works properly.


Content d’avoir pu t’aider ! Si jamais tu as d’autres questions, n’hésite pas ! Bonne continuation 😊