Hello, I have this problem. When creating an indicator, the sum of decimal fractions is rounded, but I need it without rounding. For example: 5.5+5.25=10.8 but in fact the result should be 10.75

Hi Maks

I assume that you are wanting to use these calculations as a Count Indicator, and not a derived indicator with a numerator and denominator?

The rounding is automatic, but if you specify that you want 2 decimal points, it should give you the 10.75 that you are looking for. If you do not set the desired decimal points, it will automatically round up the values.

Hope this helps you

Norah

Hello, I have this problem. When creating an indicator, the sum of decimal fractions is rounded, but I need it without rounding. For example: 5.5+5.25=10.8 but in fact the result should be 10.75

Hi @Islan_Kalysbekov ,

This can be adjusted with the â€śDecimals in data outputâ€ť parameter for each indicator. Choose your indicator which should have decimals in the maintenance app, and then specify two (in this case). The default is zero.

Best regards,

Jason

did everything as you said, but the result is the same, screenshots were taken below

select the decimal in the data input drop-down field, as you can choose the number of decimals number from the list down.

Good Luck

Hi dear community,

Thank you for your suggestions and support.

The problem is the dataSet collecting form automatically rounding the indicatorâ€™s result. The indicator calculated perfectly fine, but dataset form displays it rounded. Is there any way to set number of decimal digits to be displayed?

As an example you can check DataEntry form for EPI Stock on DHIS 2 Demo - Sierra Leone

As you can see here is calculated indicator (End Balance) automatically getting rounded. How it can be adjusted and displayed with 2 decimal digits?

Thank you.

Regard,

Ulanbek

Hi there!

I found another way to handle this issue.

You should use regular input field instead of indicator.

For instance, you have to input fields with 2 decimal places and an input field which make sum these two input fields.Add this script into your HTML file of custom dataset and adjust it according to your needs (IDs of input fields);

function calculateSum_with_decimal_places() {

var inputFieldIDs = [

â€śID1â€ť,

â€śID2â€ť

];`var sum = 0; for (var i = 0; i < inputFieldIDs.length; i++) { var inputField = document.getElementById(inputFieldIDs[i]); var inputValue = inputField.value === null || inputField.value === "" ? 0.00 : parseFloat(inputField.value); sum += inputValue; } var roundedSum = sum.toFixed(2); var outputField = document.getElementById("ID3"); outputField.value = roundedSum; outputField.dispatchEvent(new Event("change")); } function bindInputFieldEvents() { var inputFieldIDs = [ "ID1", "ID2" ]; for (var i = 0; i < inputFieldIDs.length; i++) { var inputField = document.getElementById(inputFieldIDs[i]); inputField.addEventListener("blur", calculateSum_with_decimal_places); } } // Call the bindInputFieldEvents function to bind the lostfocus event to input fields bindInputFieldEvents();`

Here the ID1 and ID2 are IDs of decimal input fields and ID3 is ID of input field that calculating sum of ID1 and ID2 values.

function calculateSum_with_decimal_places() - doing calculations

function bindInputFieldEvents() - launch function calculateSum_with_decimal_places() when blur event of ID1 and ID2 input fields is occured.

Hope this will be helpfull.

Warm regards,

Adil