Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hola a todos
Extraito a través de DirectQuery una columna llamada 'Comentarios'. Algunas filas de esta columna contienen texto con diferentes longitudes y símbolos. ¿Conoces alguna fórmula que pueda usar para los siguientes formatos con el fin de extraer sólo el comentario?
Comentarios (vista actual) | El resultado deseado |
. Emocionante. | . Emocionante. |
++++ | ++++ |
08.00h. NNP | Nnp |
020 John Will O'Keefe: 00:30 (2019.03.01) Trabajo O.E. | Trabajo O.E. |
021 Andrew Olsen: 00:45 (2020.04.05) No funciona | 00:45 (2020.04.05) No funciona |
La transformación más necesaria es para la 4a y 5a fila- En la 4a fila solo necesito el texto después de la fecha, y en la 5a fila necesito cada uno después del signo de columna (:)
Gracias de antemano.
Hola @EmaVasileva
Pruebe a continuación o descargue el archivo pbix adjunto para obtener más información
Measure =
VAR __comments = SELECTEDVALUE( 'Table'[Comments (current view)] )
VAR __len = LEN( __comments )
VAR __notWorking = SEARCH( "Not Working", __comments, 1, 0 ) > 0
VAR __working = SEARCH( "Working O.E.", __comments, 1, 0 ) > 0
VAR __NNP = SEARCH( "NNP", __comments, 1, 0 ) > 0
RETURN
SWITCH(
TRUE(),
__notWorking, MID( __comments, SEARCH( ":", __comments, 1, 0 ) + 1, __len ),
__working, "Working O.E.",
__NNP, "NNP",
__comments
)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hY9BC4JAEIX/ysNTkgzPVam8dehSoN08mKfaUpIVzKif3+5CQXToXYb3ZuYbpq4DgX4eu6kzF4FTEP1ENmyiOphb2a4vznMpZCsoir3b8sXnitgOrUHV9T3Kw51Ui53WZ52DzBNiphivhIkwDlEN49WeQikbcZwvjzcyxtqcRv1A2d+08aA0cyBFYSrMQhTD9IH5P/7PNM0L", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Comments (current view)" = _t, #"The desired result" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Comments (current view)", type text}, {"The desired result", type text}}),
#"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([#"Comments (current view)"], "NNP ")
then "NNP"
else if Text.Contains([#"Comments (current view)"], "Working O.E.")
then "Working O.E."
else if Text.Contains([#"Comments (current view)"], "Not Working")
then Text.Trim(
Text.Middle(
[#"Comments (current view)"],
Text.PositionOf( [#"Comments (current view)"], ":" ) + 1
)
)
else [#"Comments (current view)"])
in
#"Added Conditional Column"
Como está trabajando con Direct Query, es posible que ambos no funcionen, por lo que insertar este cálculo en el origen de datos podría ser una opción.
Hola @Mariusz
Disculpas por mi respuesta tardía y gracias por la ayuda. Ninguna de las soluciones funciona en modo DirectQuery y como solución final importé la tabla necesaria y utilicé la segunda fórmula.
Aceptaré su puesto como solución. Gracias.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |