Coderman
Coderman

Reputation: 161

CALCULATETABLE with OR statement in powerBI

How do you make an OR statement in a calculate table query. I have a statement where I select data from all rows of the city Davison but I not only want info from Davison, I also want information from the city Flint. How do I do this.

Table = CALCULATETABLE(datasetnew, datasetnew[City] = "Davison")

This is it, but i want something like this.

Table = CALCULATETABLE(datasetnew, datasetnew[City] = "Davison", or datasetnew[City] = "Flint")

Upvotes: 2

Views: 737

Answers (2)

PowerStar
PowerStar

Reputation: 895

As David mentioned IN statement in DAX is nice and short, but one other way of writing it is as follows(using OR operator ||(double pipe))

Table = CALCULATETABLE(datasetnew, datasetnew[City] = "Davison" || datasetnew[City] = "Flint")

Upvotes: 1

davidebacci
davidebacci

Reputation: 30242

Try this.

Table = CALCULATETABLE(datasetnew, datasetnew[City] IN {"Davison", "Flint" })

Upvotes: 1

Related Questions