Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
FabianB
Frequent Visitor

DAX - Count all rows from a dimension table with values below a max in a fact table

Hi,
 
I am trying to develop a DAX measure.
I have a dimension table (dim_machines) that contains a name column.
I have a fact table (machine_measurements), linked to the dimension table by this name column.
The fact table contains a power column and a timestamp with many power values for the different machines at different times.
 
I am now trying to design a measure that counts all machines that never have power values > 20.
 
here is what I tried so far:
InactiveCount =
 CALCULATE(COUNT(dim_machines[name]),FILTER(VALUES(dim_machines[name]),MAX(machine_measurements[power])<20))
 
The measure gives me a blank value. I think what is happening is that it is calculating the MAX value for the whole fact table instead of calculating it for each machine separately.
Can anyone give me a hint on how to solve this?
 
Many thanks!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Count Machines < 20 =
COUNTROWS(
FILTER(dim_machines,
NOT(COUNTROWS(FILTER(machine_measurements, machine_measurements[power] > 20 && machine_measurements[name] = dim_machines[name])) > 0)
)
)

 

Hey could you try this and let me know if it works? Thanks! 🙂 

View solution in original post

3 REPLIES 3
FabianB
Frequent Visitor

Works like a charm. Thank you so much!

Anonymous
Not applicable

You're very welcome! Glad i could help!

Anonymous
Not applicable

Count Machines < 20 =
COUNTROWS(
FILTER(dim_machines,
NOT(COUNTROWS(FILTER(machine_measurements, machine_measurements[power] > 20 && machine_measurements[name] = dim_machines[name])) > 0)
)
)

 

Hey could you try this and let me know if it works? Thanks! 🙂 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.