Forum Discussion

stribor45's avatar
stribor45
Post Prodigy
2 years ago
Solved

Pull the value from returned row

Since my table returned is not base table and it is produced using this code

 

VAR Y  = ADDCOLUMNS ( X, "@RANK", RANKX ( X, [@COUNT],,, DENSE ) )
VAR Z =  FILTER (Y, [@RANK] = 1)

Z table looks like this

CountryAnonymous@RANK
Australia26771

 

How do I get the value "Australia"?

  • Hi stribor45,

     

    Sorry about that. I had made a typo, where I had put two brackets instead of one. 

     

    Try this: 

     

    FIRSTNONBLANK(SELECTCOLUMNS(FILTER (Y, [@RANK] = 1),"Country",Y[Country]),[Country])

     

     

     

8 Replies

  • Hi stribor45 ,

     

    Can you try like this:

    VAR Z = FIRSTNONBLANK(SELECTCOLUMNS(FILTER (Y, [@RANK] = 1),"Country",Y[Country])),[Country])
  • This code works for me in DAX Studio but when I move it over to my report data doesnt change when I move slicer

     

    DEFINE
    
    VAR SummaryTable =
        SUMMARIZE(
            FILTER('AGENTS TABLE', 'AGENTS TABLE'[Country] <> "Canada"),
            'AGENTS TABLE'[Country],
            "TotalCount", COUNT('AGENTS TABLE'[Call ID])
        )
    
    VAR RankedTable =
        ADDCOLUMNS(
            SummaryTable,
            "Rank",
            RANKX(SummaryTable, [TotalCount], , DESC)
        )
    
    EVALUATE 
        RankedTable