Forum Discussion

adp_81's avatar
adp_81
Frequent Visitor
4 years ago
Solved

Showing maximun value in Card

I have a table, something like:

DateNum_Connections
2021-01-015
2021-01-0210
2021-01-031
2021-01-045
......

 

I would like to show in a Card the maximum Num_Connections (10) and in another card the date in which that max was achieved (2021-01-02)

 

Can this be done?

Thanks! 

 

  • adp_81 

    maybe you can try this

    Measure 2 = maxx(values('Table'[Date]),[Num_Connections])
    
    Measure 3 = 
    VAR tbl= SUMMARIZE('Table','Table'[Date],"connections",distinctcount('Table'[Num_Connections]))
    VAR tbl2=ADDCOLUMNS(tbl,"CHECK",RANKX(TBL,[connections],,DESC))
    return maxx(FILTER(tbl2,[CHECK]=1),'Table'[Date])
    

5 Replies

  • adp_81 

    Measure for Max Num Conn

    Max Num Conn = MAX(Tablename[Num_Connections])


    Measure for Date of the Max Num Conn

    Max Num Conn Date = 
    VAR __MAX = [Max Num Conn]
    RETURN
    MAXX( FILTER(  ALL(Tablename[Date]), [Max Num Conn] = __MAX ) , Tablename[Date] )
    

     



    • adp_81's avatar
      adp_81
      Frequent Visitor

      Hello Fowny, 

       

      Thank you for your reply. I forgot to mention that my Num_Connections column is a measure... its formula is: 

      Num_Connections = DISTINCTCOUNT(connections[userId])+0

       

      I've been googling about it and found this formula:

       

      MaxConnections = MAXX(ALL(connections), Num_Connections)

       

      but it is not working. I also tried:

      MaxConnections = MAXX(ALL(connections), DISTINCTCOUNT(connections[userId]))
       
      which does not work either. 
       
      Any ideas? 
      Thanks
      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        adp_81 

        maybe you can try this

        Measure 2 = maxx(values('Table'[Date]),[Num_Connections])
        
        Measure 3 = 
        VAR tbl= SUMMARIZE('Table','Table'[Date],"connections",distinctcount('Table'[Num_Connections]))
        VAR tbl2=ADDCOLUMNS(tbl,"CHECK",RANKX(TBL,[connections],,DESC))
        return maxx(FILTER(tbl2,[CHECK]=1),'Table'[Date])