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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors