Forum Discussion
Calculating dynamic count of linked objects
Hi all,
Hopefully I can get a little help with a count measure.
I have two identical tables of Items and customers who bought them (sample):
| Item | Customer |
| Item 1 | Bob |
| Item 2 | Susy |
| Item 3 | Mary |
| Item 4 | Joe |
| Item 5 | Joe |
| Item 6 | Joe |
These tables are linked by customer name so that if you have them side by side and selected Item 5 from table one it would then show Items 4, 5, and 6 from table two.
I'm looking to create a measure that will count the items on table two that are returned excluding the identical item from table 1. So something like this:
| Item | Customer | Item | Customer | Measure 1 | |
| Item 1 | Bob | Item 4 | Joe | 1 | |
| Item 2 | Susy | Item 5 | Joe | ||
| Item 3 | Mary | Item 6 | Joe | 1 | |
| Item 4 | Joe | ||||
| Item 5 | Joe | ||||
| Item 6 | Joe |
Hopefully there is a way to do this.
Hi STS_Joshua
Try the following measures
Measure = CALCULATE(COUNT(Table2[Item]),EXCEPT(Table2,Table1)) Measure 2 = CALCULATE(COUNT(Table2[Item]),ALL(Table2)) Measure 3 = [Measure]/[Measure 2]
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- STS_JoshuaHelper II
Well I figured that out through some trial and error.
Measure1 = CALCULATE(COUNT('Table2'[Item]), EXCEPT('Table2', 'Table1'))
Now I'm having an issue with determining that item's % of that value. In the above example I'd like another measure to show Item 4 and 5 as 50% of the total count of filtered items.
- STS_JoshuaHelper II
Like this:
- v-juanli-msftCommunity Support
Hi STS_Joshua
Try the following measures
Measure = CALCULATE(COUNT(Table2[Item]),EXCEPT(Table2,Table1)) Measure 2 = CALCULATE(COUNT(Table2[Item]),ALL(Table2)) Measure 3 = [Measure]/[Measure 2]
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - v-juanli-msftCommunity Support
Hi STS_Joshua
Is this problem sloved?
If not, please let me know.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.