Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

FUNCTION IF DOES NOT WORK

Hi,

I'm trying to use a function IF to change the name of the Cities to "Others" if they are not in my Top 15 based on highiest billing but my DAX isn't working.
I don't know if it is important but I also have a column "Year" that I use to filter in the visual.

I created this measure:

TopNCities = RANKX(ALL(BASE_RES_TABLEAU[CITY]),CALCULATE(SUM(BASE_RES_TABLEAU[Billing])))

And then I tried to create this column but is not working:
TopCity = IF([TopNCities] <= 15, BASE_RES_TABLEAU[CITY], "Others")

What I'm doing wrong?




 

3 Replies

  • eliasayyy's avatar
    eliasayyy
    Icon for Memorable Member rankMemorable Member

    You need to use allexcept(table,year) if you are filtering by year

    • Anonymous's avatar
      Anonymous
      Not applicable

      where do I use allexcept(table,year)?

      • eliasayyy's avatar
        eliasayyy
        Icon for Memorable Member rankMemorable Member

        In you rankx function instead of all