# Table.SelectRows IF parameter not equal...



## kcmuppet (Dec 14, 2020)

Hello

I'm trying to filter by the field named Clinic based on the value of a text parameter, named p_SelectedClinics, if its value isn't "All",  but struggling with the syntax. 

This gives me "Expression.SyntaxError: Token Comma expected." and  wiggly line under 'then'


```
#"Filtered Rows" = Table.SelectRows(#"Changed Type",  each If [p_SelectedClinics] <> "All" then [Clinic] = p_SelectedClinics),
```

How should it be written?

My next line is a filter which does work, but ideally all the filtering would be one step


```
#"Filter by dates" = Table.SelectRows(#"Filtered Rows", each [Date] >= p_ReportStartDate and [Date] <= p_ReportEndDate),
```

Guidance greatly appreciated!


----------



## kcmuppet (Dec 14, 2020)

I couldn't work out how to do it so went with this in the end:


```
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each p_SelectedClinic = "All" or [Clinic] = p_SelectedClinic and [Date] >= p_ReportStartDate and [Date] <= p_ReportEndDate)
```


----------

