Forum Discussion

HugoREGIS's avatar
HugoREGIS
Regular Visitor
1 year ago
Solved

Switch not working properly

I'd like to  sum columns from differents tables depending of the filter i apply :  - If i select "CRC1", i'd like to sum the amount of calls registered in the table "CRC1 - NB APPELS".  - If i sele...
  • rajendraongole1's avatar
    1 year ago

    Hi HugoREGIS -can you cross check once on, if  all tables (CRC1 - NB APPELS, CRC2 - NB APPELS, etc.) have valid relationships with the filter table (Table correspondance CRC), or that they're all independent.

    check the Modified measure:

    Measure Call Count =
    SWITCH(
    TRUE(),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "CRC 1", CALCULATE(SUM('CRC1 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "CRC 2", CALCULATE(SUM('CRC2 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "CRC 3", CALCULATE(SUM('CRC3 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "CRC 4", CALCULATE(SUM('CRC4 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "CRC 5", CALCULATE(SUM('CRC5 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "REP 1", CALCULATE(SUM('REP1 - NB APPELS'[Nombre d'appels externes])),
    SELECTEDVALUE('Table correspondance CRC'[Type]) = "REP 2", CALCULATE(SUM('REP2 - NB APPELS'[Nombre d'appels externes])),
    "Non attribué"
    )

     

    Let me know if this resolves your issue or if there’s something else to investigate!

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi HugoREGIS 

     

    Thanks for the reply from rajendraongole1 , FlipFlop1 and Tahreem24 .

     

    Did rajendraongole1 's and FlipFlop1 's methods solve your problem? If yes, could you please mark them as solutions? This will be of great help to other users experiencing similar problems. Thank you!

     

    In my test, the tables can be calculated normally regardless of whether there is a relationship between them. The following is my test for your reference.

     

    My sample:

     

     

     

    Measure:

     

     

    Measure = SWITCH(TRUE(),
    SELECTEDVALUE(Slicer[Category]) = "A", SUM('A Table'[Value]), 
    SELECTEDVALUE(Slicer[Category]) = "B", SUM('B Table'[Value])
    )

     

     

     

    Output:

     

    1. no relationships

     

     

     

    2. have relationships

     

     

     

    Best Regards,
    Yulia Xu

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.