Forum Discussion

VoltesDev's avatar
VoltesDev
Helper V
2 years ago
Solved

Why RANKX doesn't working on decimal value ?

Hi,

When I have these kind of data :

 

 

As per picture, I have now some rank which is duplicate (same rank). Altough my rank now "looking" at my column "news count decimal" which is basically have 2 different decimal value if we look at row 1 and 2.

 

I currently using this DAX :

Rank provider =
        RANKX(
                SUMMARIZE(ALL (my_table), my_table[provider]),
                          [News count decimal],,
                          DESC, Dense
            )

 

Before that formula, I also using this :

Rank provider =
        RANKX(
                ALLSELECTED(my_table[provider]),
                [News count decimal]
            )

The result also wrong:

 

How to get the correct RANK ?

Thanks

  • VoltesDev Well, you can always just say To **Bleep** with RANKX: To *Bleep* with RANKX! - Microsoft Fabric Community

    PBIX is attached below signature. 

    Rank Provider 4 = 
        VAR __Provider = MAX('table1'[Provider])
        VAR __Table = SUMMARIZE( ALLSELECTED('table1'), [provider], "__Value", COUNTROWS(DISTINCT('table1'[title])) + RAND() )
        VAR __Value = MAXX( FILTER( __Table, [provider] = __Provider), [__Value])
        VAR __Result = COUNTROWS( FILTER( __Table, [__Value] >= __Value) )
    RETURN
        __Result

     

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    VoltesDev Can't replicate this. See PBIX attached below signature. Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • VoltesDev's avatar
      VoltesDev
      Helper V

      Hi Greg,

       

      How can we attach the file ?

      I actually already prepare for the pbix, but seems I cannot upload in here.

       

      The data for sample is like this:

      providertitle
      6abc NewsNews Feed
      ABCThe Latest | US is removing aid pier from Gaza coast again due to weather, officials say
      ABC Action NewsFlorida News
      ABC NewsPolitical News
      ABC NewsTechnology News
      abc13Watch ABC News Live's 'Pride Across America' featuring nation's largest LGBTQ+ parades, marches
      abc13Watch 'Race for the White House' & ABC News' coverage of the CNN Presidential Debate on June 27
      ABC30 Action NewsWatch 'Battle for the White House' & ABC News' coverage of the CNN Presidential Debate on June 27
      abp LIVEBreaking News Highlights: CBI Registers FIR In UGC-NET Paper Leak Case, Says Report
      AdNewsDigital News Report: Australia 2024 - At a glance
      AgWebLatest From News
      Al Jazeera EnglishAsia News
      Al Jazeera EnglishMiddle East News
      Athlon Sports on MSN.com**bleep** Vitale Drops Honest Admission on Latest Caitlin Clark News
      Athlon Sports on MSN.comLakers News: Lakers Land Purdue Standout Zach Edey In Latest 2024 NBA Mock Draft
      Austin American-StatesmanOU softball transfer tracker 2024: Latest portal news, roster updates for Sooners
      Austin American-StatesmanYork city bridge makes Top 10 list of worst spans in region; the latest on its replacement
      Australian Broadcasting CorporationAUDIO: ABC News Melbourne
      Australian Broadcasting CorporationVIDEO: News in 90 Seconds
      Australian Broadcasting CorporationWeekly news quiz: Peter Dutton's nuclear snack, an irreverent war film, and a freaky-looking fish
      Barron'sStock Market News: Dow Rises
      Barron'sStock Market News: Dow Rises After PCE Data
      Barron'sStock Market News: Dow Set to Open Down
      Barron'sStock Market News: Dow Wavers
      BBCBBC News - 10:00 Farage on Putin, JK Rowling on Labour, Gaza - BBC Sounds
      BBCBBC News - 14:00 Farage on Ukraine, JK Rowling on Labour, Tenerife - BBC Sounds
      BBCBBC World Service
      BBCEuro 2024 latest news live: England, Scotland & Mbappe injury updates
      BBCLatest football news and transfer gossip, plus build-up to Europa Conference League final
      BBCLatest News
      BBCSouth Korea
      BBCSpain
      BBC on MSN.comJohn McGinn news conference - key points
      BBC on MSN.comNewcastle United news: Anthony Gordon describes bike crash
      BBC on MSN.comStephen Nolan ends legal action against The Irish News
      BBC on MSN.comSteve Clarke news conference - key points
      Birmingham Mail on MSN.comMet Office, BBC, Sky News break silence over 30C UK heatwave 'next week'
      Bloomberg on MSN.comDemocrats have begun to talk about replacing Biden for the 2024 election. Here’s how that would work—and the hurdles to it happening
      Business StandardLIVE news: Amit Shah to attend Yoga Day celebrations in Gujarat
      Business Today on MSN.comSapphire Foods shares in news as board approves stock split
      Business Today on MSN.comTCS shares in news today after US court imposes Rs 1,600 crore penalty
      businesstech.co.zaBad news for coffee lovers in South Africa
      CarsNews & videos
      CastanetRCMP bomb squad and New West police remove a suspected explosive device
      CBC.caCity cyber attackers were 'well-funded, organized,' it will take years to recover, experts say
      CBC.caKris Siddiqi takes the news quiz
      CBS News on MSN.comCBS News price tracker shows how much food, utility and housing costs are rising
      CBS News on MSN.comGeorge Latimer wins NY-16 primary, CBS News projects, beating incumbent Jamaal Bowman
      CBS Sports on MSN.comSpain vs. Italy live stream, prediction: Where to watch Euro 2024 online, odds, TV channel, start time, news
      CBSSports.com2024 NBA Draft tracker, results, news: Lakers getting a steal, Zach Edey filling a need lead Round 1 takeaways
      CBSSports.com2024 NBA Draft trade tracker: Latest news on NBA deals, every traded pick in first, second rounds
      CBSSports.com2024 NBA free agency: Ranking top 30 players, tracking latest news as Malik Monk agrees to new Kings deal
      CBSSports.comTwins get good news on injury front, visit Mariners
      Centreforaviation.comCAPA News Briefs
      Channel NewsAsia SingaporeCNA is Singapore's most trusted news brand for 6th year in a row: Reuters Institute report
      Channel NewsAsia SingaporeUkraine's Zelenskyy, Qatari emir discuss how to end war, Qatari news report says
      Charlotte ObserverDuke basketball standout Kyle Filipowski passed over in first round of NBA Draft
      CoinTelegraphBitcoin (BTC) Crypto News Today
      colliderFans of The Hulk Will Be Smashing Their Keyboards at This News
      collider'Superman' Set Photos, 'Nosferatu' Trailer, and All The Big Movie News You Missed This Week
      Columbus DispatchOklahoma State softball transfer tracker 2024: Latest portal news, Cowgirls roster updates
      Couriermail‘Never seen before’: Sydney’s heartbreaking problem
      CouriermailLatest sign King Charles refuses to mend bond with Prince Harry
      CTV NewsB.C. highway reopened after school bus, pedestrian crashes that killed 1 and sent 14 to hospital
      CTV NewsCTV News Windsor’s top stories from this week
      CTV NewsDevice found in New Westminster found to be explosive; major crime unit takes over
      CTV NewsFeels like 40: Heat wave sticking around in Ontario, Quebec, Maritimes
      CTV NewsNewfoundland and Labrador getting help from Quebec, Ontario to battle wildfires
      CTV NewsThree people facing charges following seizure of drugs, weapon in Kingston, Ont.
      Cycle News2024 Dutch MotoGP News and Results (Updated)
      Daily ExpressSusanna Reid halts Good Morning Britain for breaking news announcement
      Daily Express on MSN.comRoyal Family: Prince Harry issued blunt warning as Firm is 'united' despite 'attacks'
      Daily MailBREAKING NEWSLiverpool confirm club legend Alan Hansen has been DISCHARGED from hospital
      Daily MailBREAKING NEWSPolice searching for missing former colleague of MoneySavingExpert Martin Lewis find body
      Daily MailDonald Trump
      Daily MailFootball Transfer News - Latest News and Updates
      Daily MailGeorgia 0-0 Czechia - Euro 2024: Live score, team news and updates as Napoli's Khvicha Kvaratskhelia starts for Georgians, while West Ham duo Vladimir Coufal and Tomas Soucek ...
      Daily MailPoland vs Austria - Euro 2024: Live score, team news and updates as the 74,000 capacity stadium plays host to crunch
      Daily MailWorld News

       

      The "News count" is measure by using this :

      News count = DISTINCTCOUNTNOBLANK('table1'[title])
       
      and the News count with decimal :
      News count decimal =
      VAR _random = RAND()
      RETURN
      [News count] + _random
       
       
      and rank using those in my original thread.
       
      Thanks.
       
       

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        VoltesDev Well, you can always just say To **Bleep** with RANKX: To *Bleep* with RANKX! - Microsoft Fabric Community

        PBIX is attached below signature. 

        Rank Provider 4 = 
            VAR __Provider = MAX('table1'[Provider])
            VAR __Table = SUMMARIZE( ALLSELECTED('table1'), [provider], "__Value", COUNTROWS(DISTINCT('table1'[title])) + RAND() )
            VAR __Value = MAXX( FILTER( __Table, [provider] = __Provider), [__Value])
            VAR __Result = COUNTROWS( FILTER( __Table, [__Value] >= __Value) )
        RETURN
            __Result