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
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:
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 11 | |
| 10 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |