Forum Discussion
'IN' Operator in 'New Measure'
- 10 years ago
hi,
you would need to put the values you want in the IN predicates into a separate table i.e. PREDICATES.
here's the sample setup that i created to illustrate this case:
FactT PREDICATES Category Amount Column1Values_IN Value1 100 Value1 Value1 50 Value2 Value2 10 Value3 Value2 20 Value2 30 Value3 10 Value4 40 Value3 90 Value4 1000 Value4 500 Value5 432 Value6 593 Value6 876 and then you could use this formula:
TotalAmt_IN =
CALCULATE ( SUM('FactT'[Revenue]),
FILTER ( 'FactT', CONTAINS(PREDICATES, PREDICATES[Column1Values_IN], 'FactT'[Column1] ) )
)
the formula returns 310 based on the above data.
hope this helps,
radpir
hi,
you would need to put the values you want in the IN predicates into a separate table i.e. PREDICATES.
here's the sample setup that i created to illustrate this case:
| FactT | PREDICATES | ||
| Category | Amount | Column1Values_IN | |
| Value1 | 100 | Value1 | |
| Value1 | 50 | Value2 | |
| Value2 | 10 | Value3 | |
| Value2 | 20 | ||
| Value2 | 30 | ||
| Value3 | 10 | ||
| Value4 | 40 | ||
| Value3 | 90 | ||
| Value4 | 1000 | ||
| Value4 | 500 | ||
| Value5 | 432 | ||
| Value6 | 593 | ||
| Value6 | 876 |
and then you could use this formula:
TotalAmt_IN =
CALCULATE ( SUM('FactT'[Revenue]),
FILTER ( 'FactT', CONTAINS(PREDICATES, PREDICATES[Column1Values_IN], 'FactT'[Column1] ) )
)
the formula returns 310 based on the above data.
hope this helps,
radpir