Forum Discussion
Sum rows only with specific values in other column
Hi pawelj795 ,
First add a calculated column :
Column =
var a=SEARCH(0,'Table'[ItemID],1,0)
var b=SEARCH(9,'Table'[ItemID],1,0)
Return
IF(a=0&&b=0,1,0)
Then correct measure as below:
Measure =
CALCULATE(SUM('Table'[Visitors]),FILTER('Table','Table'[Trans_ type]<>0&&'Table'[Trans_ type]<>9&&'Table'[Column]=1))
For the related .pbix file,pls click here.
Best Regards,
Kelly
Hi v-kelly-msft
Shouldn't be TransType instead of ItemID in below measure and also OR instead of AND?
Column = var a=SEARCH(0,'Table'[ItemID],1,0) var b=SEARCH(9,'Table'[ItemID],1,0) Return IF(a=0&&b=0,1,0)
- pawelj7956 years ago
Post Prodigy
v-kelly-msft
Even with my above adjustments or with precisely your measure, it still only exlude transactions with trans type 0 or 9, not whole Index (ItemID)- pawelj7956 years ago
Post Prodigy
v-kelly-msft
It's possible to do what I want?
- v-kelly-msft6 years ago
Community Support
Hi pawelj795 ,
a=0 means there's no 0 in the column, so is b ,so a=0&&b=0 means there's no 0 or 9 in column ID, you said all the rows which contains 0 or 9 in column ID and TransType should all be excluded...so in my measure I have excluded all the posibilities.I have checked my result,it satisfies your need,where do you find not work?
Best Regards,
KellyDid I answer your question? Mark my post as a solution!- pawelj7956 years ago
Post Prodigy
Hi v-kelly-msft,
I tried to do what I want in your file and it still doesn't work.
Look on shared pbix.
https://drive.google.com/open?id=1DpCDU2v4xJwMyeXjbFMCJX5RAFQEZg6N
ItemID's which I marked should be also on the table rightward.
Why they aren't?