Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

TOP 10 countries using DAX code

Hello Experts,
I want to help me to write the DAX code to show only the TOP 10 Countries based on Revenue.

 

7 Replies

  • SpartaBI's avatar
    SpartaBI
    Icon for Community Champion rankCommunity Champion

    Anonymous 

     

    Top 10 Countries By Revenues = 
    VAR _top10_countries = TOPN(10, ALLSELECTED('Table'[Country]),[Revenues Measure])
    RETURN
        CALCULATE(
            [Sales Amount],
            KEEPFILTERS(_top10_countries)
        )

     

     


    In case it answered your question, please accept the solution to help other members find it. Appreciate Your Kudos.

    Showcase Report – Contoso By SpartaBI


    Visit SpartaBI website   Visit SpartaBI Linkdin   Visit SpartaBI Facebook

    SpartaBI Logo

    • Anonymous's avatar
      Anonymous
      Not applicable

      SpartaBI 
      its dose not worked,
      see the right visual which I used a filter pane to show  the top 10 countries. 
      In your code dax which is in left visual it dose give the top 10 countries and the numbers are nor correct.

       

      • SpartaBI's avatar
        SpartaBI
        Icon for Community Champion rankCommunity Champion

        Anonymous what is the column you use in the matrix for country, and what ia the base measure?