# Dashboard in Kibana: Boolean vs. Count Distinct offered Field

**URL:** https://discuss.elastic.co/t/dashboard-in-kibana-boolean-vs-count-distinct-offered-field/356838
**Category:** Kibana
**Tags:** dashboard
**Created:** [April 5, 2024, 5:38am UTC](https://discuss.elastic.co/t/dashboard-in-kibana-boolean-vs-count-distinct-offered-field/356838 "2024-04-05T05:38:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Manoj\_Prabhakar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/manoj_prabhakar/32/133302_2.png) [@Manoj\_Prabhakar](https://discuss.elastic.co/u/Manoj_Prabhakar)
#### Post date: [April 5, 2024, 5:38am UTC](https://discuss.elastic.co/t/dashboard-in-kibana-boolean-vs-count-distinct-offered-field/356838/1 "2024-04-05T05:38:11Z")

</div>

I'm trying to create a real queue dashboard in Kibana using the `cxi_data_view` index pattern. The data includes fields like `queueName`, `offered`, etc. I'm unsure about the `offered` field. It might be a boolean indicating whether a conversation was offered or a count of distinct conversation IDs for each queue entry. How can I create visualizations in Kibana that consider both interpretations of the `offered` field? I initially created a new field (`new_offered`) to filter for offered conversations (true values), but I'm not sure if that's the right approach. I used this calculation for the new field new offered = New Offered = if (doc['offered'].value == true) {  
emit(1);  
} else {  
emit(0);  
}, but db admin told offered is equal to count distinct of conversation\_ID. I want to know if my calculation/approach is correct or it needs any changes

---

<div class="post-metadata">

### Author: ![jsanz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsanz/32/53734_2.png) [@jsanz](https://discuss.elastic.co/u/jsanz)
#### Post date: [April 30, 2024, 11:33am UTC](https://discuss.elastic.co/t/dashboard-in-kibana-boolean-vs-count-distinct-offered-field/356838/2 "2024-04-30T11:33:25Z")

</div>

To get a new runtime field checking for another field existence you can use this code:

```auto
emit(doc['offered'].size() > 0)

```

And set the field type as `Boolean` as I did on this screenshot for the Kibana Flights dataset and a new `hasCarrier` boolean field.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/1/8154bf10aa15ae08621dd73378e56ef7d1be3a43.png)

That should give you a field that easily documents with any value in `offered`. This approach is not different from doing that filtering directly in the Kibana filter bar.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/4/f40f408095e2c05f786a58f98d9a2cb96312b2de.png)
