Forum Discussion
Arooz
6 years agoNew Member
Measure returns true if all rows contain the same value
Hi, I would like to add a Column/Measure 'Free Entirely' which is True when the 'Type' is "Free" for all rows with the same 'Name'. I am rather new at DAX and have been stuck at this for a ...
- 6 years ago
Try this measure.
FreeEntirely = VAR _selectedName = CALCULATE ( SELECTEDVALUE ( 'Table'[Name] ) ) VAR _countName = CALCULATE ( COUNT ( 'Table'[Name] ) ) VAR _countNameFree = CALCULATE ( COUNT ( 'Table'[Name] ), FILTER ( ALL ( 'Table'[Name] ), 'Table'[Name] = _selectedName ), 'Table'[Type] = "Free" ) VAR result = IF ( _countName = _countNameFree, TRUE (), FALSE () ) RETURN resultThis will not work if you add the Time field into the visual.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
nandukrishnavs
Community Champion
6 years agoTry this measure.
FreeEntirely =
VAR _selectedName =
CALCULATE ( SELECTEDVALUE ( 'Table'[Name] ) )
VAR _countName =
CALCULATE ( COUNT ( 'Table'[Name] ) )
VAR _countNameFree =
CALCULATE (
COUNT ( 'Table'[Name] ),
FILTER ( ALL ( 'Table'[Name] ), 'Table'[Name] = _selectedName ),
'Table'[Type] = "Free"
)
VAR result =
IF ( _countName = _countNameFree, TRUE (), FALSE () )
RETURN
result
This will not work if you add the Time field into the visual.
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Arooz
6 years agoNew Member
Worked like a charm, thanks!