Forum Discussion
Anonymous
7 years agoNot applicable
DAX COUNTX giving wrong results
Hi, I am trying to get my code to count the number of dates that have a rank or 5 or anything below 5. I tried to do this with the code below but it doesn't seem to work, could any one help please? ...
- 7 years ago
Anonymous
try like this:
Bottom Nth Value = COUNTROWS( FILTER( ALL( 'Date Table' ), RANKX( ALL( 'Date Table' ), [TotalValue], , DESC, Dense ) < 6 ) ) - 7 years ago
Anonymous
For your measure to work you need to remove the filter from 'Year and Month' and from 'Date' such as below:
Bottom 5 = VAR N = 5 RETURN COUNTX ( SUMMARIZE ( 'Date Table', 'Date Table'[Year and Month], "total", RANKX ( ALL ( 'Date Table'[Year and Month], 'Date Table'[Date] ), CALCULATE ( SUM ( Data[Value] ) ), , ASC, DENSE ) ), IF ( [total] <= N, [total], BLANK () ) )
LivioLanzo
Solution Sage
7 years agoHi Anonymous
can you post the raw data?
- Anonymous7 years agoNot applicable
Sure, here are some images of the tables i used
- LivioLanzo7 years ago
Solution Sage
Hi Anonymous,
sorry but I can't work with a snapshot. Are you able to post data which can be copy/pasted?
- Anonymous7 years agoNot applicable
Sorry i think this may help more;
https://filebin.net/qlgusdv2f3w0pfm4
you can access the pbix file i am working on there and the file i am using too.