# Error in bar graph on decimals

I'm getting a wrong visualization when trying to showcase a graph using just 1 decimal.

The graph is showing two bars with a height of 4,81 and 4,80 (out of 5). The data should only contain 1 decimal showing 4,8 for both bars. However the graph doesn't show the same height on both graphs. It is as if the bars is using my measure to show multiple decimals even though i've defined my measure to ONLY show 1 decimal.

Anybody got a solution?

0

## Comments

Louise Stub HansenHi Lasse

Im not sure I understand your case correct. But if you have a graph the decimals can be affected by the formats you choose in the left menu bar and in the properties of your grapf (number format for your labels):

Maybe you should check if they both are set at 1 decimal for the measure.

But I guess that the hight of the bars will show the actual value (with decimals) regardless of the format of your labels. If you wish to round your numbers, I think you should add a calculated column that rounds your numbers. Unfortunately I don't know if there is a round-function in the Targit syntax.

Lasse JørgensenYou understand it perfectly.

Here is an example:

For the viewer it seems that the bars is not the same height on the left. I've checked and both the formatting in targit and the measure is set to 1 decimal. Is it a kind of bug perhaps?

Louise Stub HansenI don't think it is a bug. But the bars just dosn't round the numbers but show the actual value.

Eg. if the values are 3,86 and 3,94, the labels will be 3,9 but the bars will still show 3,86 and 3,94 -> not the same hight.

Ole DyringHi Lasse,

As you and Louise have correctly observed, just changing the number of decimals doesn't change the size of the bars in a bar chart.

You should create a calculation for each of your measures, and use the round function to get you values properly rounded.

Result modifiers: https://community.targit.com/hc/en-us/articles/360017917898-Result-Modifiers

BR / Ole

Lasse JørgensenHi Ole,

Thx for the link, i will try that solution.

However, can you elaborate on the point i made above. If my measure is pre-defined to only contain 1 decimal, why is it that the bars sizes calculates with more decimals? Is it because the chart ignores my pre-defined condition to the measure? Or is it something else?

Ole DyringHi Lasse,

Even if your measures are pre-defined (from the data warehouse) to contain only a certain number of decimals, they will still carry over all necessary information, to the x'th decimal. This is necessary to ensure that e.g. summation of large numbers of values still returns the correct result. And charts will always work on the detailed numbers.

Also, this is only a pre-definition of the number format of your measures. In the client, you can always override the pre-defined number format, e.g. to 4 decimals, and you will see that the detail data indeed is carried across.

So, if you want to work on rounded numbers, the number formatting option is not enough. You will need to use the 'round()' result modifier I mentioned above.

See my example here. In the upper chart I just kept the Profit Margin measure, but changed the number format of my labels to 4 decimals. (It was pre-defined to no decimals, as in the crosstab.) In the lower chart I replaced my measure with a calculation: round(sum(d1, 0, m1)). In the lower chart, you can see that now the Japan/United States bars are exactly same height. And the same for the Norway/Portugal bars.

BR / Ole

Lasse JørgensenHi Ole,

Thx for the explanation!

And your solution regarding the round-function worked perfectly - thx for the tip.

Sincerely

Lasse

Please sign in to leave a comment.