Nemo
Nemo

Reputation: 1227

DAX - Create a table based on a condition

I have the following table Table

enter image description here

Where Other Columns represent multiple other columns of the large Table. How can I create another table that contains only rows for person p1 and p3 who provided a comment, and only the first 3 columns (WITHOUT other multiple columns after column Person? The desired output should look like this

enter image description here

Upvotes: 1

Views: 2007

Answers (2)

davidebacci
davidebacci

Reputation: 30219

enter image description here

Table 2 = 
VAR comments = CALCULATETABLE( VALUES('Table'[Person]), 'Table'[Comment] <> "") 
VAR tbl = FILTER('Table', 'Table'[Person] IN comments)
RETURN SELECTCOLUMNS( tbl, "Score", 'Table'[Score], "Comment", 'Table'[Comment], "Person", 'Table'[Person])

Upvotes: 1

davidebacci
davidebacci

Reputation: 30219

Table 2 = 
VAR comments = CALCULATETABLE( VALUES('Table'[Person]), 'Table'[Comment] <> "") 
VAR tbl = FILTER('Table', 'Table'[Person] = comments)
RETURN tbl

Upvotes: 1

Related Questions