Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
2 years ago
Solved

Ayuda de DAX

Hola, necesito ayuda con la siguiente sintaxis de DAX.

Tengo un Measure [cantidad total] y necesito obtener algo de DAX para hacer lo siguiente:

Si [cantidad total] < 1000, divida [cantidad total] por 1. Si [cantidad total] < 5000, divida [cantidad total] por 2, SI [cantidad total] < 50000, luego divida [cantidad total] por 4, SI [cantidad total] > 50000 luego divida [cantidad total] por 6.

Las múltiples condiciones me están haciendo tropezar.

Gracias

  • Puede utilizar la función SWITCH para evitar varias sentencias IF, es decir,

    Your Measure = SWITCH(TRUE(), 
        [total qty] < 1000, Divide([total qty], 1),
        [total qty] < 5000 Divide([total qty], 2), 
        [total qty] < 50000, Divide([total qty], 4),
        [total qty] > 50000, Divide([total qty], 6)
    )
    

2 Replies

  • Puede utilizar la función SWITCH para evitar varias sentencias IF, es decir,

    Your Measure = SWITCH(TRUE(), 
        [total qty] < 1000, Divide([total qty], 1),
        [total qty] < 5000 Divide([total qty], 2), 
        [total qty] < 50000, Divide([total qty], 4),
        [total qty] > 50000, Divide([total qty], 6)
    )
    

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      Vicki, eres ROCK, muchas gracias, esto FUNCIONA. He pasado los últimos 2 días tratando de que funcione. GRACIAS por ser parte de esta gran comunidad.