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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
dmcmillin
Regular Visitor

Table Array

Hi All,

 

I have tried using pivot and unpivot and transposing but can't quite figure out how to transform my table from this:

 

Any help would be appreciated

 

Part NumTo Part
CCXCVC7XTN
CCXCVP5YFN
CCXCVTNTCT

 

to this:

 

Part NumDev1Dev2Dev3
CCXCVC7XTNP5YFNTNTCT
1 ACCEPTED SOLUTION

Hi, please check the below picture and the attached pbix file.

I am not sure how it is defined to understand what comes for Dev1 / Dev2 / Dev3, but I hope you get the ideas on how to create the solution for your business logic.

 

Jihwan_Kim_0-1688613068824.png

 

New Table =
ADDCOLUMNS (
    VALUES ( Data[Part Num] ),
    "Dev1",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                1,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        ),
    "Dev2",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                2,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        ),
    "Dev3",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                3,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a new table by using DAX.

Jihwan_Kim_0-1688578122196.png

 

 

New Table = 
ADDCOLUMNS (
    VALUES ( Data[Part Num] ),
    "Dev1",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX ( 1, SUMMARIZE ( Data, Data[To Part] ), ORDERBY ( Data[To Part] ) )
        ),
    "Dev2",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX ( 2, SUMMARIZE ( Data, Data[To Part] ), ORDERBY ( Data[To Part] ) )
        ),
    "Dev3",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX ( 3, SUMMARIZE ( Data, Data[To Part] ), ORDERBY ( Data[To Part] ) )
        )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim you understood the concept. Thank you.

 

This is very odd, and may be because I am a new user but I can't reply with a .pbix file like you did.

 

I am unable to get what you produced to work and might be because I provided partial data. Here is a larger sample size which has different parts and different deviations that would have to be transposed:

 

Part NumTo Part
CCR41JW30H
CCXCVC7XTN
CCXCVP5YFN
CCXCVTNTCT
CC0F0G6R99
CC0F056D99
CDDMJXX7MT
CF4C1CC0F0
CGNVH6KNWW
CG0M0K18NP
CG48D0W8VV
CJMMK6FDH8
CJX0FWV4KK
CMFND6M9N4
CMPGMY26KX
CM9TJX3PK1
CPFWHWCF6J
CPFWH2N6C5
CP6106JKXY
CR72X68ND3
CTWCNC8T2P
CTWCNMGPPC

 

to look like this:

 

Part NumDev1Dev2Dev3
CCR41JW30H  
CCXCVC7XTNP5YFNTNTCT
CC0F0G6R9956D99 
CDDMJXX7MT  
CF4C1CC0F0  
CGNVH6KNWW  
CG0M0K18NP  
CG48D0W8VV  
CJMMK6FDH8  
CJX0FWV4KK  
CMFND6M9N4  
CMPGMY26KX  
CM9TJX3PK1  
CPFWHWCF6J2N6C5 
CP6106JKXY  
CR72X68ND3  
CTWCNC8T2PMGPPC 

Hi, please check the below picture and the attached pbix file.

I am not sure how it is defined to understand what comes for Dev1 / Dev2 / Dev3, but I hope you get the ideas on how to create the solution for your business logic.

 

Jihwan_Kim_0-1688613068824.png

 

New Table =
ADDCOLUMNS (
    VALUES ( Data[Part Num] ),
    "Dev1",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                1,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        ),
    "Dev2",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                2,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        ),
    "Dev3",
        CALCULATE (
            MAX ( Data[To Part] ),
            INDEX (
                3,
                SUMMARIZE (
                    FILTER ( Data, Data[Part Num] = EARLIER ( Data[Part Num] ) ),
                    Data[To Part]
                ),
                ORDERBY ( Data[To Part] )
            )
        )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim Thank you! I will make this work.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.