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
caslus
Helper I
Helper I

Conversor de fila a columnas por dax en la misma tabla

Tengo esto en mi mesa:

FechaLIM FDOGLUE FRPY
26 de febrero208686A
26 de febrero9392166B

Y necesito mostrar esto como una tabla en mi tablero:

FechaVALORYDes
26 de febrero208ALIM FDO
26 de febrero939BLIM FDO
26 de febrero686AGLUE FRP
26 de febrero2166BGLUE FRP

No tengo idea de cómo hacer esto en DAX, y necesito hacer esto en DAX

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hola @caslus ,

Forma DAX :

Table 2 =
VAR a =
    SELECTCOLUMNS ( 'Table', "und", 'Table'[UND], "date_", 'Table'[DATE] )
VAR k =
    CROSSJOIN ( { "LIM FDO", "LIM FRP" }, a )
RETURN
    ADDCOLUMNS (
        k,
        "result", IF (
            [Value] = "LIM FDO",
            CALCULATE ( SUM ( 'Table'[LIM FRP] ) ),
            IF ( [Value] = "LIM FRP", CALCULATE ( SUM ( 'Table'[LIM FDO] ) ) )
        )
    )

2.PNG

Pbix como adjunto.

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Greg_Deckler
Super User
Super User

Creo que quieres desenriste tus dos columnas intermedias, así:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnEMcVXSUfLx9FVwc/GHsYICgKxQPxelWJ1oJSMz/bTUMqCAkYEFkDSzMAOSjqhSlsaWIAWGZiA5J6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
    #"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
    #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"DATE", type text}, {"LIM FDO", Int64.Type}, {"LIM FRP", Int64.Type}, {"UND", type text}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type1", {"DATE", "UND"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

¿Esto está en la consulta de energía?

Necesito hacer esto en DAX, porque tengo otras columnas en mi tabla.

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.