Forum Discussion
DAX Count Keys not working
- 2 years ago
use this code :
Column = CALCULATE( COUNT('FACT'[KEY]) , ALLEXCEPT('FACT','FACT'[KEY]) )your first measure should work
the issue is that you are counting distinct key, so it should return 1 not 2 .
since the first 2 rows, the keys are equal .
the code i have provided will count ( not distinct )
let me know if this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠 - Anonymous2 years ago
Hi EPower21 ,
You can also create a calculated column.
_Key Count = CALCULATE( COUNT('FACT'[KEY]) , 'FACT'[KEY]=EARLIER('FACT'[KEY]) )Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi EPower21 ,
You can also create a calculated column.
_Key Count =
CALCULATE(
COUNT('FACT'[KEY]) ,
'FACT'[KEY]=EARLIER('FACT'[KEY])
)
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.