Question: I am trying to create a KPI for the tasks schedule we have on a calendar.

The formula I have is:

```
"<div><img src='/_layouts/images/KPIDefault-"&IF(Completed="Yes",0,2)&".gif'/></div>"

```

This works however I would like to add that if a task is (Completed="In Progress") that it changes to the yellow triangle icon.

The formula I have tried is:

```
=<div><img src='/_layouts/images/KPIDefault-"&IF(Completed="Yes",0,2)&".gif'/><img src='/_layouts/images/KPIDefault-"IF(Completed="In Progress",0,1)&".gif'/></div>

```

I realize that this is probably dead easy but I am new to calculated columns.

The default icon wants to be red.

Answer: 
```
="<center>"&IF([Completed]="", "<img src='/_layouts/images/KPIDefault-2.GIF' border='0'/>",(IF([Completed]="In Progress","<img src='/_layouts/images/KPIDefault-1.GIF' border='0'/>", (IF([Completed]="Yes","<img src='/_layouts/images/KPIDefault-0.GIF' border='0'/>")))&"</center>"

```

Remember to set the calculated column to type "Number" for the calculation to work. 

![enter image description here](https://i.stack.imgur.com/fHadS.png)
The other answer is correct.

I suggest to rewrite it a bit, more like your original formula

If you are starting out with calculated columns it helps to keep them as short as possible and spread them over multiple lines.

```
="<img src=""/_layouts/images/kpidefault-"
  &IF([Completed]="In Progress","1", IF([Completed]="Yes","0","2"))
&".gif"">"

```

Note

* the default value is 2 , no need to use an extra IF for that
* I replaced the single quotes that open/close the src attribute with TWO double quotes, this results in a single double quote when the Formula is calculated and makes it better readable when you output the Formula as Text to verify the HTML
* the border attribute for an IMG is 0 by default, so no need to include it

More at: <https://www.365csi.nl/vm365com/#/How>