# CASE select not functioning as expected

**URL:** <https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177>\
**Category:** Questions & Answers\
**Tags:** markdown, calculatedmembers, mdx\
**Created:** [October 26, 2021, 10:26am UTC](https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177 "2021-10-26T10:26:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/k/eb8c5e/32.png) [@Keir](https://community.eazybi.com/u/Keir)\
**Post date:** [October 26, 2021, 10:26am UTC](https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177/1 "2021-10-26T10:26:57Z")

</div>

I have a calculated field which calculates the time in days spent between 2 stages (our cycle time).

I am demonstrating this for the current month and the last month with an additional markdown field demonstrating the change.

As part of this I am using the below selection… but I am not getting the expected equals result where the numbers for both calculated fields are the same.

Any ideas?

```auto
 CASE
        WHEN
        -- if cycle time is decreased, show green arrow down
             [Measures].[CYCLE_TIME (This Month)] < 
             [Measures].[CYCLE_TIME (Last Month)]
         THEN
      "<i class='far fa-arrow-down' style='color:green'></i>"
         WHEN
        -- if the cycle time is increased, show red arrow up  
             [Measures].[CYCLE_TIME (This Month)] > 
             [Measures].[CYCLE_TIME (Last Month)]
         THEN
     "<i class='far fa-arrow-up' style='color:red'></i>"
         ELSE
     "<i class='far fa-equals' style='color:orange'></i>"
         END

```

![image](https://community.eazybi.com/uploads/default/original/2X/8/83c6b9c10937f8a77e3cbeebe73e5fc80f42835d.png)

---

<div class="post-metadata">

**Author:** ![Keir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/k/eb8c5e/32.png) [@Keir](https://community.eazybi.com/u/Keir)\
**Post date:** [October 26, 2021, 10:56am UTC](https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177/2 "2021-10-26T10:56:17Z")

</div>

The calculated fields are being converted to Integer. Is there likely to be an issue here, is the comparison being done on a decimal field and therefore being seen as not equal?

---

<div class="post-metadata">

**Author:** ![ilze.leite](https://community.eazybi.com/user_avatar/community.eazybi.com/ilze.leite/32/19_2.png) [@ilze.leite](https://community.eazybi.com/u/ilze.leite)\
**Post date:** [November 8, 2021, 10:58am UTC](https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177/3 "2021-11-08T10:58:32Z")

</div>

Hi @Keir

You are correct about integers and decimals: in the calculation, the decimal value is compared, regardless of the formatting.

You may compare only rounded values, use Round() function for that: [Round](https://docs.eazybi.com/eazybi/analyze-and-visualize/calculated-measures-and-members/mdx-function-reference/round)

```auto
Round([Measures].[CYCLE_TIME (This Month)], 0) <
Round([Measures].[CYCLE_TIME (Last Month)], 0)

```

If you want to display some character also for cases when the values are equal, then add a specific WHEN condition for a case when the values are the same (with = instead of \< or \>).  
Otherwise, for equal (rounded) values the field will be empty (it is ok, if this is your case).

Best,  
Ilze / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![Keir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/k/eb8c5e/32.png) [@Keir](https://community.eazybi.com/u/Keir)\
**Post date:** [November 8, 2021, 2:25pm UTC](https://community.eazybi.com/t/case-select-not-functioning-as-expected/8177/4 "2021-11-08T14:25:39Z")

</div>

Thanks @ilze.leite - will give that a go 😃
