March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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 @Anonymous ,
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 @Anonymous ,
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
16 | |
15 | |
7 | |
7 |
User | Count |
---|---|
37 | |
31 | |
16 | |
16 | |
12 |