Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Estoy teniendo problemas con la función switch
Necesito agregar una columna con fórmula y que haga:
Si en la columna "semana" dice "Semana 1" y en la columna "mes" dice 4, entonces en la columna nueva agregar "14"
Si en la columna "semana" dice "Semana 2" y en la columna "mes" dice 4, entonces en la columna nueva agregar "15"
Si en la columna "semana" dice "Semana 3" y en la columna "mes" dice 4, entonces en la columna nueva agregar "16"
Si en la columna "semana" dice "Semana 4" y en la columna "mes" dice 4, entonces en la columna nueva agregar "17"
Si en la columna "semana" dice "Semana 5" y en la columna "mes" dice 4, entonces en la columna nueva agregar "18"
Si en la columna "semana" dice "Semana 1" y en la columna "mes" dice 5, entonces en la columna nueva agregar "18"
Si en la columna "semana" dice "Semana 2" y en la columna "mes" dice 5, entonces en la columna nueva agregar "19"
Y así sucesivamente.
El código que tengo es
SWITCH (
True ()
'Tabla'[Atributo] = "Semana 1" && 'Tabla'[mes] = 4, 14,
'Tabla'[Atributo] = "Semana 2" && 'Tabla'[mes] = 4, 15,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 4, 16,
'Tabla'[Atributo] = "Semana 4" && 'Tabla'[mes] = 4, 17,
'Tabla'[Atributo] = "Semana 5" && 'Tabla'[mes] = 4, 18,
'Tabla'[Atributo] = "Semana 1" && 'Tabla'[mes] = 5, 18,
'Tabla'[Atributo] = "Semana 2" && 'Tabla'[mes] = 5, 19,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 5, 20,
'Tabla'[Atributo] = "Semana 4" && 'Tabla'[mes] = 5, 21,
'Tabla'[Atributo] = "Semana 5" && 'Tabla'[mes] = 5, 22,
'Tabla'[Atributo] = "Semana 1" && 'Tabla'[mes] = 6, 23,
'Tabla'[Atributo] = "Semana 2" && 'Tabla'[mes] = 6, 24,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 6, 25,
'Tabla'[Atributo] = "Semana 4" && 'Tabla'[mes] = 6, 26,
'Tabla'[Atributo] = "Semana 1" && 'Tabla'[mes] = 7, 27,
'Tabla'[Atributo] = "Semana 2" && 'Tabla'[mes] = 7, 28,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 7, 29,
'Tabla'[Atributo] = "Semana 4" && 'Tabla'[mes] = 7, 29,
'Tabla'[Atributo] = "Semana 5" && 'Tabla'[mes] = 7, 30,
'Tabla'[Atributo] = "Semana 1" && 'Tabla'[mes] = 8, 30,
'Tabla'[Atributo] = "Semana 2" && 'Tabla'[mes] = 8, 31,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 8, 32,
'Tabla'[Atributo] = "Semana 3" && 'Tabla'[mes] = 8, 33,
'Tabla'[Atributo] = "Semana 4" && 'Tabla'[mes] = 8, 34,
BLANK ()
)
Gracias por el apoyo
Solved! Go to Solution.
Hi @jdpadra ,
You can create two calculated columns as below to get the expected result:
Column =
SWITCH (
TRUE (),
'Tabla'[mes] = 4,
14 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 5,
18 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 6,
23 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 8,
30 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1
)
Weeknum =
IF (
ISBLANK ( Tabla[Column] ),
IF (
'Tabla'[Atributo] = "Semana 4",
29,
IF (
'Tabla'[Atributo] = "Semana 5",
30,
27 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1
)
),
[Column]
)
Best Regards
Thanks!
Hi @jdpadra ,
You can create two calculated columns as below to get the expected result:
Column =
SWITCH (
TRUE (),
'Tabla'[mes] = 4,
14 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 5,
18 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 6,
23 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1,
'Tabla'[mes] = 8,
30 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1
)
Weeknum =
IF (
ISBLANK ( Tabla[Column] ),
IF (
'Tabla'[Atributo] = "Semana 4",
29,
IF (
'Tabla'[Atributo] = "Semana 5",
30,
27 + VALUE ( RIGHT ( 'Tabla'[Atributo], 1 ) ) - 1
)
),
[Column]
)
Best Regards
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
User | Count |
---|---|
21 | |
21 | |
21 | |
13 | |
12 |
User | Count |
---|---|
43 | |
28 | |
25 | |
23 | |
22 |