# Round value to predefined ranges

**URL:** <https://forum.alumio.com/t/round-value-to-predefined-ranges/1339>\
**Category:** Data Transformers\
**Created:** [October 2, 2024, 9:53am UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339 "2024-10-02T09:53:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoeri](https://forum.alumio.com/letter_avatar_proxy/v4/letter/y/dc4da7/32.png) [@yoeri](https://forum.alumio.com/u/yoeri)\
**Post date:** [October 2, 2024, 9:53am UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339/1 "2024-10-02T09:53:18Z")

</div>

Hello,

How can I set a value to some predefined ranges. For example I have a key “number” with a value of 13400. I want Alumio to set a new key called “numberFilter” where the value should be 20000.

The “numberFilter” key should be restricted to the following values: 0, 20000, 40000, 60000, 80000, 100000, 120000 and 140000. A value from “number” should be round up to the nearest value. If a value is above 120000, it should always be 140000.

Is this possible with Alumio transformers?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Gugi](https://forum.alumio.com/user_avatar/forum.alumio.com/gugi/32/236_2.png) [@Gugi](https://forum.alumio.com/u/Gugi)\
**Post date:** [October 3, 2024, 12:07am UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339/2 "2024-10-03T00:07:07Z")

</div>

Hi @yoeri,

Is the key “numberFilter” reusable in other parts of the transformer? If not, we suggest using a Value Setter in combination with “Dictionary Map” to set the value of key `number`, as shown below.

 ![image](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/2X/e/e6bbffc01956549dfef035ff41a0827348a08890.png)

You can add more maps there based on the values, for example:

- number 40000 to number 60000
- number 60000 to number 80000
- number 80000 to number 100000
- and so on

By choosing “Greater than” as the comparator, it will update, for example, value `1` to `20000` or `27500` to `40000`.

Please let us know if this is not the case.

---

<div class="post-metadata">

**Author:** ![yoeri](https://forum.alumio.com/letter_avatar_proxy/v4/letter/y/dc4da7/32.png) [@yoeri](https://forum.alumio.com/u/yoeri)\
**Post date:** [October 3, 2024, 6:41am UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339/3 "2024-10-03T06:41:16Z")

</div>

Hi @Gugi,

Thank you for your reply. I tried to set this up, but in the transformer tester it doesn’t work as expected.

 ![image](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/2X/c/c7a6d310f9ebd1144cdf62e51fcfcc27a7621a1b.png)

Is there something I do wrong?

---

<div class="post-metadata">

**Author:** ![Gugi](https://forum.alumio.com/user_avatar/forum.alumio.com/gugi/32/236_2.png) [@Gugi](https://forum.alumio.com/u/Gugi)\
**Post date:** [October 3, 2024, 11:14am UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339/4 "2024-10-03T11:14:25Z")

</div>

Hi @yoeri,

We are sorry if the previous advice doesn’t work. Apparently, we should start the map from the biggest one to the lowest one, such as below.

 ![image](https://alumio-forum.s3.dualstack.eu-central-1.amazonaws.com/uploads/original/2X/2/278fc381d3885cb6bf20bdef121376d4f5012bf1.png)

Please give it a try.

---

<div class="post-metadata">

**Author:** ![yoeri](https://forum.alumio.com/letter_avatar_proxy/v4/letter/y/dc4da7/32.png) [@yoeri](https://forum.alumio.com/u/yoeri)\
**Post date:** [October 3, 2024, 2:12pm UTC](https://forum.alumio.com/t/round-value-to-predefined-ranges/1339/5 "2024-10-03T14:12:30Z")

</div>

Hi @Gugi,

Yes, this is working. Thanks!
