Forum Discussion
meskens
3 years agoFrequent Visitor
Countrows/Distinctcount DAX question
Hi all, Maybe you could help me with this one. I'm trying to how many employees are in a certain category of average sickness (for example 0), based on the months selected in the slicer. I have...
- 3 years ago
meskens
The > 3.5 seems to be working. Not sure why you're facing issues with it. I prepared a quick sample file for testing the 3 formulas.Aantal 0 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), INT ( MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) = 0 ) )Aantal > 3.5 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), INT ( MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) > 3.5 ) )Aantal 0-3.5 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), VAR MaxPercxent = MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) RETURN INT ( MaxPercxent > 0 && MaxPercxent < 3.5 ) )
meskens
3 years agoFrequent Visitor
Hi tamerj1 ,
This works great!
One more question, 1 have two more categories:
>0 and <3,5
>= 3,5
However when I change youre code to
SUMX (VALUES ( '2023'[Naam/voornaam] ),INT (MAXX (CALCULATETABLE (VALUES ( '2023'[Maand] )),[Percentage]) >3.5))
It gives no number (I have more date in my own power bi) Should have been 1
When I change the code to
Aantal 0-3.5 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), INT ( MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) > 0 && [Percentage]<3.5 ) )
It counts everything > 0 but not <3.5
What am I doing wrong?
- tamerj13 years agoCommunity Champion
meskens
The > 3.5 seems to be working. Not sure why you're facing issues with it. I prepared a quick sample file for testing the 3 formulas.Aantal 0 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), INT ( MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) = 0 ) )Aantal > 3.5 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), INT ( MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) > 3.5 ) )Aantal 0-3.5 = SUMX ( VALUES ( '2023'[Naam/voornaam] ), VAR MaxPercxent = MAXX ( CALCULATETABLE ( VALUES ( '2023'[Maand] ) ), [Percentage] ) RETURN INT ( MaxPercxent > 0 && MaxPercxent < 3.5 ) )