Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
ahmedaldafaae
Employee
Employee

Busque el primer valor no en blanco y repita para el mismo ID

Por favor, ayuda en la lucha por una medida de dax . TPID tiene varios gerentes (MWA) y necesito repetir el primer administrador para el mismo tpid. como se muestra a continuación

Valores deseados de TPID MWA

1JameJame
1BillyJame
1CamyJame
1BillyJame
2 Billy
2BillyBilly
2CamyBilly
2 Billy
3AmmarAmmar
3AmmarAmmar
3 Ammar
3CamyAmmar
1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hola @ahmedaldafaae ,

Según mi comprensión, desea utilizar el primer valor no en blanco en cada grupo de id como el valor del mismo grupo, ¿verdad?

Puede usar la siguiente fórmula después de agregar una columna de índice:

Measure =
VAR _firstnoblank =
    CALCULATE (
        MIN ( 'Table'[Index] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[TPID] = MAX ( 'Table'[TPID] )
                && 'Table'[MWA] <> BLANK ()
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[MWA] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = _firstnoblank )
    )

Mi visualización tiene este aspecto:
11.3.3.1.PNG

Aquí está el archivo pbix.

¿He respondido a tu pregunta? Por favor, marque mi respuesta como solución. Muchas gracias.
Si no es así, cargue algunas muestras de datos insensibles y la salida esperada.

Saludos
Eyelyn Qin

View solution in original post

4 REPLIES 4
v-eqin-msft
Community Support
Community Support

Hola @ahmedaldafaae ,

Según mi comprensión, desea utilizar el primer valor no en blanco en cada grupo de id como el valor del mismo grupo, ¿verdad?

Puede usar la siguiente fórmula después de agregar una columna de índice:

Measure =
VAR _firstnoblank =
    CALCULATE (
        MIN ( 'Table'[Index] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[TPID] = MAX ( 'Table'[TPID] )
                && 'Table'[MWA] <> BLANK ()
        )
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[MWA] ),
        FILTER ( ALL ( 'Table' ), 'Table'[Index] = _firstnoblank )
    )

Mi visualización tiene este aspecto:
11.3.3.1.PNG

Aquí está el archivo pbix.

¿He respondido a tu pregunta? Por favor, marque mi respuesta como solución. Muchas gracias.
Si no es así, cargue algunas muestras de datos insensibles y la salida esperada.

Saludos
Eyelyn Qin

Gracias

Simplemente funciona!!

Fowmy
Super User
Super User

@ahmedaldafaae

Probé una solución de Power Query agregando solo una columna personalizada:

Fowmy_0-1604217490883.png


Pegue el código siguiente en una consulta en blanco en el Editor avanzado y compruebe el paso agregado.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUfJKzE1VitWBcJwyc3Iq4TznxNxKLFJGQJ4CnIUqDteCUGQMZDnm5iYW4eAhVEE0xwIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TPID = _t, MWA = _t]),
    #"Added Custom" = Table.AddColumn(Source, "New MWA", (r)=>  List.First(Table.SelectRows(Source, each [TPID]  = r[TPID] and [MWA] <> " ")[MWA]))
in
    #"Added Custom"

________________________

Si mi respuesta fue útil, considere Aceptarla como la solución para ayudar a los otros miembros a encontrarla

Haga clic en el icono Thumbs-Up si le gusta esta respuesta 🙂

Youtube Linkedin

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

AllisonKennedy
Super User
Super User

¿Hay otra columna que determine el orden: necesitamos una manera de indicar a Power BI qué valor es 'primero'. Si no tiene una columna para esto, use Power Query Editor para agregar una columna Index.

A continuación, puede utilizar algo similar a esto como una columna calculada:

MWA Deseado ?
VAR _ThisTPID 'Tabla'[TPID]
VAR _tblTPIDvalues - FILTER(ALL('Table'), 'Table'[TPID] á _ThisTPID && NOT(ISBLANK('Table'[MWA])))
VAR _Index á MINX(_tblTPIDvalues, 'Table'[Index])
devolución
MINX(FILTER(_tblTPIDvalues, _Index 'Table'[Index]), 'Table'[MWA])

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.