# Calculated field with parameters

**URL:** <https://community.amazonquick.com/t/calculated-field-with-parameters/43289>\
**Category:** Q&A\
**Tags:** parameters, filters, calculations, Business-Intelligence-Engineer, quick-sight\
**Created:** [March 5, 2025, 9:56am UTC](https://community.amazonquick.com/t/calculated-field-with-parameters/43289 "2025-03-05T09:56:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![InbalK](https://avatars.discourse-cdn.com/v4/letter/i/bbce88/32.png) [@InbalK](https://community.amazonquick.com/u/InbalK)\
**Post date:** [March 5, 2025, 9:56am UTC](https://community.amazonquick.com/t/calculated-field-with-parameters/43289/1 "2025-03-05T09:56:29Z")

</div>

Hello!

I want to make a calculated field that will connect to my Parameter and filter:  
 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/2/9/298ab1d1c538990f2e0535d2b23cf2b7d2e471a9.png)

if All Events is chosen then show me {Safety Events} = ‘true’ AND {Safety Events} = ‘false’  
If Only Safety then show me only {Safety Events} = ‘true’

I tried this calculated field:  
if(  
{Safety Events} = ‘true’, ‘Only Safety’,  
{Safety Events} = ‘true’ OR {Safety Events} = ‘false’, ‘All Events’  
)

and also this:  
ifelse(  
${pSafety}= ‘Only Safety’, {Safety Events} = ‘true’,  
${pSafety}= ‘All Events’, {Safety Events} = ‘true’ and {Safety Events} = ‘false’,  
“Unknown”  
)

It doesn’t work, how can i make it happened?  
Thanks

---

<div class="post-metadata">

**Author:** ![abacon](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/abacon/32/2291_2.png) [@abacon](https://community.amazonquick.com/u/abacon)\
**Post date:** [March 5, 2025, 5:34pm UTC](https://community.amazonquick.com/t/calculated-field-with-parameters/43289/2 "2025-03-05T17:34:35Z")

</div>

Hi @InbalK,

Thanks for your question, I’ll try to help based on the scenario you’ve given.

I’m using a sales dataset, so the first thing I did was create a calculated field **cfSafetyEvents** that evaluates a row to be either true or false.

I then added a string parameter **pChoice** with a Static default value of “All Events” and a List control **cChoice** with 2 specific values defined:

> All Events  
> Only Safety

I then created a calculated field as follows:  
**cfSaftetyEventsEvaluation** - `ifelse(cfSafetyEvents="true" AND ${pChoice}="Only Safety","Only Safety","All Events")`

Finally, I created a filter that uses the **pChoice** parameter for my visual as follows:

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/4/c/4cefec304e8f1f6cf439694317364d2106b2a232.png)

Now when I select “All Events” in the control, I get this result:

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/5/4/54fdad4c8722dcc21fb560b5e99848535453af29.png)

And when I select “Only Safety” I see this instead:

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/1/c/1c8cb7421f1accf43b61cd401ef64237e84b704d.png)

Let me know if this helps and provides a solution for you.

Many Thanks,  
Andrew

---

<div class="post-metadata">

**Author:** ![InbalK](https://avatars.discourse-cdn.com/v4/letter/i/bbce88/32.png) [@InbalK](https://community.amazonquick.com/u/InbalK)\
**Post date:** [March 6, 2025, 8:46am UTC](https://community.amazonquick.com/t/calculated-field-with-parameters/43289/3 "2025-03-06T08:46:00Z")

</div>

> [@abacon](#):
>
> ifelse(cfSafetyEvents=“true” AND ${pChoice}=“Only Safety”,“Only Safety”,“All Events”)

It works! Thank you very much!
