Forum Discussion
Calculatetable filter subsets
Hello,
how to filter with Calculatetable, when I have several filter conditions?
Show only with Attribute =1 , all categories, and all types BUT when its category 222 only with type C. The other type combinations with category 222 needs to be filtered out.
My problem with that part is when I filter with the following example I only get Category 222 and Type C but not other categories:
Calculated Example Table = Calculatetable(Table (Attribute= 1, Category = 222 && Type = C) = TRUE())
My raw table:
| Category | TYPE | Attribute | ||
| 111 | A | 1 | ||
| 111 | C | 1 | ||
| 111 | D | 1 | ||
| 111 | E | 1 | ||
| 222 | A | 1 | ||
| 222 | C | 1 | ||
| 333 | C | 2 | ||
| 333 | A | 2 |
Thank you very much in advanced.
Best.
Try this:
CalcTable Filter = VAR Table1 = CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Attribute] = 1 ) ) VAR Table2 = CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Type] <> "C" && 'Table'[Category ] = 222 ) ) RETURN COUNTROWS ( EXCEPT ( Table1, Table2 ) )Applicable88 , try like
Calculatetable(Table, filter(Table, (Table[Attribute= 1] && Table[Category] <> 222) || (Table[Attribute= 1] && Table[Category] = 222 && Table[Type] = "C")) )
4 Replies
- PaulDBrownCommunity Champion
Try this:
CalcTable Filter = VAR Table1 = CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Attribute] = 1 ) ) VAR Table2 = CALCULATETABLE ( 'Table', FILTER ( 'Table', 'Table'[Type] <> "C" && 'Table'[Category ] = 222 ) ) RETURN COUNTROWS ( EXCEPT ( Table1, Table2 ) ) - amitchandakSuper User
Applicable88 , Try like
Calculated Example Table = Calculatetable(Table, filter(Table [Attribute= 1] && [Category] = 222 && [Type] = "C"))
Calculate and calculatetable are followed the almost the same syntax, one return measure and one return table
so in expression you need table
- Applicable88Impactful Individual
amitchandak when you write this:
&& [Category] = 222 && [Type] = "C")
than all other categories are also filtered out. Thats not what I was looking for.
For example 111 and 333 are also not in the calculated table.
Please advised.
- amitchandakSuper User
Applicable88 , try like
Calculatetable(Table, filter(Table, (Table[Attribute= 1] && Table[Category] <> 222) || (Table[Attribute= 1] && Table[Category] = 222 && Table[Type] = "C")) )