Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
Hope I can describe this problem correctly! I have 2 tables, not joined to each other:
FACT Table
| Location | Category A | Category B | Value |
| 1 | A | Z | 51 |
| 1 | B | X | 100 |
| 2 | A | Z | 56 |
| 2 | C | Y | 105 |
| 3 | B | W | 61 |
| 3 | D | Q | 110 |
| 4 | A | Q | 52 |
| 4 | A | Z | 102 |
Min/Max Table:
| Min | Max |
| 150 | 160 |
| 160 | 170 |
| 170 | 180 |
| ...continuing pattern |
...with each table having many, many more rows. What I am trying to do is come up with a DAX formula that will allow me to build a table visual with the following output:
| Min | Max | Count of Locations with Sum of [Values] between min/max |
| 150 | 160 | 2 |
| 160 | 170 | 1 |
| 170 | 180 | 1 |
The DAX I have tried for the "Count of Locations..." column is this:
Count of Locations =
var minV = MIN(GroupsTbl[Min])
var maxV = MAX(GroupsTbl[Max])
var sumValues = SUM(FactTbl[Value])
var locCount = CALCULATE(DISTINCTCOUNT(FactTbl[Location]),FILTER(FactTbl,sumValues>=minV),FILTER(FactTbl,sumValues<maxV))
return locCount
...but this returns an output that is not paritioned by the Location column. Something like this using the example above:
| Min | Max | Count of Locations with Sum of Values between min/max |
| 640 | 650 | 4 |
This would be pretty easy to solve by pre-aggregating the table to remove the 2 "Category" columns - but I need to be able to filter with slicers on those columns, and have the count of locations (and sum of values) update based on the selected values from the slicers.
I hope this is enough explanation - apologies if not! Happy to provide more info/answer questions! 🙂
Any help would be greatly appreciated. Thanks -Joe
Solved! Go to Solution.
Hey Joe,
This formula should provide the desired output based on the details required:
Count of Locations =
VAR MinValue = MIN(GroupsTbl[Min])
VAR MaxValue = MAX(GroupsTbl[Max])
RETURN
COUNTROWS(
FILTER(
SUMMARIZE(
FactTbl,
FactTbl[Location],
"LocationSum", SUM(FactTbl[Value])
),
[LocationSum] >= MinValue && [LocationSum] < MaxValue
)
)SUMMARIZE:
FILTER:
COUNTROWS:
Thanks to both for the help!!
Hi @JoeCochran please try this
Hey Joe,
This formula should provide the desired output based on the details required:
Count of Locations =
VAR MinValue = MIN(GroupsTbl[Min])
VAR MaxValue = MAX(GroupsTbl[Max])
RETURN
COUNTROWS(
FILTER(
SUMMARIZE(
FactTbl,
FactTbl[Location],
"LocationSum", SUM(FactTbl[Value])
),
[LocationSum] >= MinValue && [LocationSum] < MaxValue
)
)SUMMARIZE:
FILTER:
COUNTROWS:
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |