Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I'm stuck trying to get a count of values in a column that depends on several other columns.
I have a table with many Item Numbers. Each Item Number appears in several Locations and within each location it can have a different Type and different Supplier. None of the columns are related. For each Item Number I need the count of suppliers for that location, but I need to ignore any rows with Type = X.
| Item Number | Location | Type | Supplier | *Expected* Supplier Count |
| 6240 | A1 | X | 123 | 1 |
| 6240 | A1 | P | 111 | 1 |
| 6240 | A1 | T | 111 | 1 |
| 6240 | E2 | X | 111 | 2 |
| 6240 | E2 | P | 123 | 2 |
| 6240 | E2 | P | 111 | 2 |
Ultimately, I'm also trying to get a measure with the number of items that have more than one supplier, in the example above the answer is 1.
Solved! Go to Solution.
@Anonymous , A new column
calculate(distinctcount(Table[Supplier]), filter(Table, [Item Number] = earlier([Item Number]) && [Location] = earlier([Location]) && [Type]<> "X"))
@Anonymous , A new column
calculate(distinctcount(Table[Supplier]), filter(Table, [Item Number] = earlier([Item Number]) && [Location] = earlier([Location]) && [Type]<> "X"))
Thanks, that worked. EARLIER is what I was missing, I have some reading to do!
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 60 | |
| 44 | |
| 40 | |
| 37 | |
| 21 |
| User | Count |
|---|---|
| 178 | |
| 127 | |
| 116 | |
| 77 | |
| 54 |