Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
rank = COUNTROWS(FILTER(Cars,EARLIER(Cars[Rev])>Cars[Rev]))+1
For this DAX, I know that the FILTER will remove any value in Rev. column larger than $950, so they are $0, $240, and $500 in this table.
Then how does COUNTROWS work here?
I assume the COUNTROWS work in this way:
The COUNTROWS will traverse every number in the list and count how many rows meets the argument.
For $950, 3 rows meet the criteria (less than $950)
For $1170, 4 rows meet the criteria (less than $1170)
After plus 1, $950 will be ranked as 4th and $1170 will be ranked as 5th in the list which ranked numbers from small to large eventually.
Is my understanding correct?
Thank you in advance!
Solved! Go to Solution.
@Anonymous ,
You understanding of countrows() and earlier() is correct. The countrows() function will count the rows(values) which is less than currect rows(earlier(Cars[Rev])). And if you want to reverse the rank, you can just change ">" with "<" like below:
rank = COUNTROWS(FILTER(Cars,EARLIER(Cars[Rev])<Cars[Rev]))+1
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
You understanding of countrows() and earlier() is correct. The countrows() function will count the rows(values) which is less than currect rows(earlier(Cars[Rev])). And if you want to reverse the rank, you can just change ">" with "<" like below:
rank = COUNTROWS(FILTER(Cars,EARLIER(Cars[Rev])<Cars[Rev]))+1
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
I think the blog below explain the function "earlier" very well, you may refer to the blog:
https://exceleratorbi.com.au/earlier-vs-earliest-dax/
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, I feel like my question is more related to COUNTROWS instead of EARLIER. Sorry for misleading.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
74 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |