Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Switch measure value with 2 selection

I have a switch measure with below formula :

 measure = SWITCH ( SELECTEDVALUE(Column1)),"Category1",[Measure1],"Category2",[Measure2],"Category3",[Measure3]...))

Now when i select Category1 and Category2 in Slicer, the measure is blank, i know switch only works on 1 selection. Is there any alternate way to achieve this?

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    I just tried this and it's working for me:

     

    IF(AND(SELECTEDVALUE('Table1'[Column1]) = "whatever", SELECTEDVALUE('Table2'[Column2]) = "2nd whatever"), "Bring me this",

    IF(AND(SELECTEDVALUE('Table1'[Column1]) = "otherwhatever", SELECTEDVALUE('Table2'[Column2]) = "2nd otherwhatever"), "Bring me this other thing"))

     

    Seemingly you can nest it as far as you want, I'm at 2 criteria, 2 selections each for a possible combination of 4. I don't know if that's the best way to do this but I haven't been able to find any other suggestions and it is working <shrug>

     

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I just tried this and it's working for me:

     

    IF(AND(SELECTEDVALUE('Table1'[Column1]) = "whatever", SELECTEDVALUE('Table2'[Column2]) = "2nd whatever"), "Bring me this",

    IF(AND(SELECTEDVALUE('Table1'[Column1]) = "otherwhatever", SELECTEDVALUE('Table2'[Column2]) = "2nd otherwhatever"), "Bring me this other thing"))

     

    Seemingly you can nest it as far as you want, I'm at 2 criteria, 2 selections each for a possible combination of 4. I don't know if that's the best way to do this but I haven't been able to find any other suggestions and it is working <shrug>

     

  • Jhophshepht's avatar
    Jhophshepht
    Frequent Visitor

    Hola, creo que tengo una duda similar al primer comentario, en mi caso en el cuadro que se muestra por defecto quiero mostrar más de un dato de una misma columna, me explico, tengo un gráfico de barras que muestra los días en que se realizó un inventario, en el popup se muestran varios datos que agregue, pero hay uno que es el nombre del proveedor y son varios por día, cuando agrego la columna al tooltip solo me muestra el primero o el último, se pueden mostrar todos? 

    asi es como sale ahora, la segunda fila categoria, la tengo en otra tabla, 

     

    si lo hago con la misma tabla, me sale solo un nombre, el primero o el ultimo

     

    la idea es que salgan todos estos.

    COLISEO CV TRADING
    COMERCIAL MARSHALL Y SALAS SPA
    MODULBOX SPA
    NUTRISCO CHILE S A
    SOCIEDAD PUNTA DE LOBOS SA
    TAMY SPA
    TECNOPAPEL S A

    y despues de poder hacer eso, poder poner un switch de condicion, para que muestre otra columna en el caso de otra condicion.

     

    La otra opcion que tambien me sirve es agregar una hoja nueva con la informacion como un tooltip, la estuve creando pero puedo mostrar la informacion que necesito, pero ademas necesito usar un switch supongo para cambiar la informacion. 

    este es para un almacen.

    este es para otro 

    en ambos almacenes cuando hay mas de una categoria al dia. no muestra informacion

    encontre esta formula : 

    Categorias =
    VAR slicerValue = SELECTEDVALUE(Afta[whsA])
    RETURN
        SWITCH(
            TRUE,
            slicerValue = "Merkadis",
                [CatM],
            TRUE,  
                VALUE([CatP])
        )
     
    que usa estas dos.
     
    CatM = SELECTEDVALUE(Afta[Proveedor])
    CatP = SELECTEDVALUE(Afta[Peso])
     
    en escencia lo que necesito es mostrar para "Merkadis" la columna proveedor con todos sus registros y para "Purina" la columna peso con todos sus registros.