Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi ,
I Have applied Ranx to my Table which looks as below . In the first snapshot below have grouped the countries to show the Sales amount in Desc Order .
2 ND SNAPSHOT
| country | CountryRank | usd_amount | Amount TOP4 + Others |
| China | 1 | 128393088 | China |
| Australia | 2 | 33131855 | Australia |
| Taiwan | 3 | 4507356 | Taiwan |
| Hong Kong SAR China | 4 | 2191428 | Hong Kong SAR China |
| New Zealand | 5 | 2037118 | Others |
| Singapore | 6 | 1383320 | Others |
| Malaysia | 7 | 1280955 | Others |
| Philippines | 8 | 1128673 | Others |
| Canada | 9 | 910346 | Others |
| United Kingdom | 10 | 687390 | Others |
| Cambodia | 11 | 611389 | Others |
| Switzerland | 12 | 411285 | Others |
| United Arab Emirates | 13 | 342534 | Others |
| Netherlands | 14 | 330287 | Others |
| Turkey | 15 | 286855 | Others |
| South Korea | 16 | 256078 | Others |
| Italy | 17 | 243511 | Others |
| Macau SAR China | 18 | 225516 | Others |
| Germany | 19 | 220078 | Others |
| Vietnam | 20 | 159515 | Others |
| Indonesia | 21 | 140793 | Others |
| Thailand | 22 | 110061 | Others |
| Norway | 23 | 92062 | Others |
| France | 24 | 89876 | Others |
| Spain | 25 | 85145 | Others |
| Peru | 26 | 76861 | Others |
| Portugal | 27 | 65064 | Others |
| United States | 28 | 60863 | Others |
| Belgium | 29 | 49253 | Others |
| Bhutan | 30 | 49021 | Others |
| Qatar | 31 | 48396 | Others |
| Japan | 32 | 47374 | Others |
| India | 33 | 47196 | Others |
| Morocco | 34 | 43827 | Others |
| Pakistan | 35 | 38784 | Others |
| Saudi Arabia | 36 | 29448 | Others |
| Kuwait | 37 | 29294 | Others |
| Luxembourg | 38 | 28678 | Others |
| Zambia | 39 | 28132 | Others |
| Brunei | 40 | 27662 | Others |
| Mexico | 41 | 24950 | Others |
| Ireland | 42 | 23599 | Others |
| Timor-Leste | 43 | 20845 | Others |
| Hungary | 44 | 20674 | Others |
| Finland | 45 | 20314 | Others |
| Sweden | 46 | 19178 | Others |
| Czech Republic | 47 | 18720 | Others |
| Romania | 48 | 18278 | Others |
| Slovakia | 49 | 16703 | Others |
| Denmark | 50 | 14367 | Others |
| South Africa | 51 | 14327 | Others |
| Cayman Islands | 52 | 13500 | Others |
| Russia | 53 | 13233 | Others |
| Hong Kong | 54 | 13230 | Others |
| U.S. Minor Outlying Islands | 55 | 12900 | Others |
| Nigeria | 56 | 12170 | Others |
| Austria | 57 | 11459 | Others |
| Greece | 58 | 9917 | Others |
| Bangladesh | 59 | 8201 | Others |
| Kenya | 60 | 8008 | Others |
| Brazil | 61 | 6936 | Others |
| SEf | 62 | 6430 | Others |
| Colombia | 63 | 5330 | Others |
| Poland | 64 | 5143 | Others |
| Lebanon | 65 | 4673 | Others |
| Cyprus | 66 | 4583 | Others |
| American Samoa | 67 | 4567 | Others |
| U.S. Virgin Islands | 68 | 4295 | Others |
| Maldives | 69 | 4195 | Others |
| Azerbaijan | 70 | 4110 | Others |
| Myanmar [Burma] | 71 | 3957 | Others |
| Mauritius | 72 | 3553 | Others |
| Iceland | 73 | 3380 | Others |
| Bulgaria | 74 | 3090 | Others |
| Oman | 75 | 2900 | Others |
| Bahrain | 76 | 2300 | Others |
| Israel | 77 | 2118 | Others |
| Monaco | 78 | 2100 | Others |
| Belarus | 79 | 1771 | Others |
| Jordan | 80 | 1600 | Others |
| Guam | 81 | 1500 | Others |
| Guatemala | 82 | 1460 | Others |
| Afghanistan | 83 | 1372 | Others |
| Sri Lanka | 84 | 1347 | Others |
| Lithuania | 85 | 1345 | Others |
| Martinique | 86 | 1034 | Others |
| Argentina | 87 | 1000 | Others |
| Botswana | 87 | 1000 | Others |
| Panama | 87 | 1000 | Others |
| Tajikistan | 90 | 994 | Others |
| Benin | 91 | 899 | Others |
| Jamaica | 92 | 719 | Others |
| Uganda | 93 | 715 | Others |
| Egypt | 94 | 696 | Others |
| Saint Martin | 95 | 602 | Others |
| Slovenia | 96 | 600 | Others |
| Uzbekistan | 97 | 570 | Others |
| Malta | 98 | 500 | Others |
| Croatia | 99 | 411 | Others |
| Ukraine | 100 | 404 | Others |
| Ecuador | 101 | 300 | Others |
| Tanzania | 101 | 300 | Others |
| Moldova | 103 | 250 | Others |
| Georgia | 104 | 200 | Others |
| Paraguay | 104 | 200 | Others |
| Chile | 106 | 191 | Others |
| Estonia | 107 | 170 | Others |
| Cuba | 108 | 168 | Others |
| Mozambique | 109 | 140 | Others |
| Ghana | 110 | 120 | Others |
| Latvia | 111 | 110 | Others |
| Equatorial Guinea | 112 | 104 | Others |
| Costa Rica | 113 | 100 | Others |
| Dominican Republic | 113 | 100 | Others |
| Nepal | 113 | 100 | Others |
| Northern Mariana Islands | 113 | 100 | Others |
| Serbia | 113 | 100 | Others |
| Suriname | 113 | 100 | Others |
| Unknown or Invalid Region | 113 | 100 | Others |
| EN | 120 | 99 | Others |
Solved! Go to Solution.
Hi, @burnaNayak , strange enough😂 it's works at my side. I attached a file for your further reference.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@burnaNayak
Can you check this video from SQLBI, it can be useful for your to get the results you are after.
https://www.youtube.com/watch?v=tgL7D3JTa_E
________________________
If my answer was helpful, please consider Accept it as the solution to help the other members find it
Click on the Thumbs-Up icon if you like this reply 🙂
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi, @burnaNayak , you're only one inch away from your goal.
But there's a glitch in your measure, which throws error in such a viz
Therefore, I amend it and author another measure to achieve the goal as you described.
CountryRank amended =
RANKX (
ALLSELECTED ( user_first_deposit ),
CALCULATE ( SUM ( user_first_deposit[usd_amount] ) )
)
////////////////////
TOP4 = IF( [CountryRank amended] <= 4, MAX(user_first_deposit[country]), "Other")
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi ,
If I add the countryrankamended , it looks like the 1st snapshot
But once i add the Top 4 column , the 2nd snapshot changes as below and is not giving me what i expected .
1st Snapshot
2nd Snapshot
Hi, @burnaNayak , strange enough😂 it's works at my side. I attached a file for your further reference.
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |