# sum of counts within same row Power apps

need to the display the total counts of three different columns that display "FREE" within the same gallery row. using formula:

CountIf('Desk reservation',Status = "FREE", Status_2= "FREE", Status_3= "FREE")

Formula above is only giving the total amount of rows and only for one column. any ideas?

Use the below formula to calculate the values based on different columns in a single row,

``````With({
status1: If(ThisItem.Status = "Free", 1, 0),
status2: If(ThisItem.Status_2 = "Free", 1, 0),
status3: If(ThisItem.Status_3 = "Free", 1, 0)
}, Sum(status1, status2, status3))
``````

Hope this solves your problem in PowerApps.

• Dear Shantha, it worked nicely. Excellent out of the box thinking! Thanks a million Jun 17 '21 at 5:59
• I needed to add to the add if result =0, red colour otherwise green. On the fill function I'm using, it is not changing red in 0 . any ideas? If(With({ status1: If(ThisItem.Status = "Free", 1, 0), status2: If(ThisItem.Status_2 = "Free", 1, 0), status3: If(ThisItem.Status_3 = "Free", 1, 0) }, Sum(status1, status2, status3))= "0", RGBA(220,50,35,1), RGBA(25,170,110, 1)) Jun 17 '21 at 10:23
• Remove the double quotes around 0. Use the below formula, If(With({ status1: If(ThisItem.Status = "Free", 1, 0), status2: If(ThisItem.Status_2 = "Free", 1, 0), status3: If(ThisItem.Status_3 = "Free", 1, 0) }, Sum(status1, status2, status3))= 0, RGBA(220,50,35,1), RGBA(25,170,110, 1)) Jun 17 '21 at 11:20
• Shantha, thanks a million. it worked great! :) Jun 17 '21 at 16:12
• you're welcome. Jun 17 '21 at 18:13