Forum Discussion

felipe_pinto's avatar
felipe_pinto
Helper I
4 years ago
Solved

Measure - How to define the maxx value using DAX

Hello guys,   I have the measure below, wich I need to get the max value.  This exemple, it shows me the week that had more request in the month. However, I also needed that the measure show me th...
  • VahidDM's avatar
    4 years ago

    Hi felipe_pinto 

     

    Try this to find the Name of the week:

    Concentração DPP Name = 
    
    VAR Semana1 = CALCULATE(COUNTROWS(fGeral),fGeral[Semana]=1,fGeral[Divisão SAP]=200)
    VAR Semana2 = CALCULATE(COUNTROWS(fGeral),fGeral[Semana]=2,fGeral[Divisão SAP]=200)
    VAR Semana3 = CALCULATE(COUNTROWS(fGeral),fGeral[Semana]=3,fGeral[Divisão SAP]=200)
    VAR Semana4 = CALCULATE(COUNTROWS(fGeral),fGeral[Semana]=4,fGeral[Divisão SAP]=200)
    Var _M = 
    Maxx(
        UNION(
            Row("MEDIDA",Semana1),
            Row("MEDIDA",Semana2),
            Row("MEDIDA",Semana3),
            Row("MEDIDA",Semana4)
        ),
        [MEDIDA]
    )
    return
    SWITCH(TRUE(),
    _M = Semana1,"Semana1",
    _M = Semana2,"Semana2",
    _M = Semana3,"Semana3",
    _M = Semana4,"Semana4"
    )

     

    Output:

     

     

     

    If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
    Appreciate your Kudos!!
    LinkedIn: 
    www.linkedin.com/in/vahid-dm/