Forum Discussion
Victormar
Helper V
3 years agoChecking if all the values are the same
Hello community,
I am working in a measure that shows the contracted speed value for a bus fleet. The key is that all the buses are supposed to have the same value, and this is what I would lik...
- 3 years ago
Hi,
You could utilize COUNTROWS and DISTINCT.
DAX:Measure 21 =
IF(COUNTROWS(DISTINCT('Table (12)'[Column2]))>1,1,0)
E.g. (non distinct values:e.g. distinct:
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/
ValtteriN
Community Champion
3 years agoHmm,
How about using ALLSELECTED to limit the filter context to only selected fleet? So something like this structure: IF(COUNTROWS(DISTINCT(ALLSELECTED(DIM_Chassis[FLEET_FLEET_ID]))))
Victormar
Helper V
3 years agommm, yeah I see the logic, but then it turns out that it's returning how many fleets I have selected, not if the chassis inside the fleet have the same value, if that makes sense?
Contracted AVG Energy Usage kWh/km = if(
ISFILTERED(DIM_Chassis[FLEET_FLEET_ID]) && IF(COUNTROWS(DISTINCT(ALLSELECTED(DIM_Chassis[T_CHASSIS])))>1,1,0),
"More than one value",
MAX(DIM_Chassis[D_ENERGY_CONSUMPTION_THEORICAL])
)