Forum Discussion

Saxon10's avatar
Saxon10
Post Prodigy
5 years ago

Unpivot row to column by using Union function

 

I have 4 columns are Type, Id, Area & result and those 4 columns return multiple values. I would like to group the Type, Id and Area.

 

I am looking for DAX column to achieve my final result.

 

Data

 

TYPE

ID

AREA

RESULT

TR

1

DD1

IND/001,PAK/008

TR

1

DD1

IND/001,PAK/008

TR

1

DD1

IND/001,PAK/008

TR

1

DD1

IND/001,PAK/008

TR

1

DD1

IND/001,PAK/008

TR

1

DD1

IND/001,PAK/008

TR

2

DD2

SRI/DMK

TR

3

DD3

AUS/101,USA/234

TR

3

DD3

AUS/101,USA/234

TR

3

DD3

AUS/101,USA/234

TR

3

DD3

AUS/101,USA/234

PTR

1

ED1

IND/001,PAK/008

PTR

2

ED2

SRI/DMK

PTR

3

ED3

AUS/101,USA/234

PTR

3

ED3

AUS/101,USA/234

PTR

3

ED3

AUS/101,USA/234

PTR

3

ED3

AUS/101,USA/234

 

Result

 

TYPE

ID

DD1

DD2

DD3

TR

1

IND/001,PAK/008

 

 

TR

2

 

SRI/DMK

 

TR

3

 

 

AUS/101,USA/234

TYPE

ID

ED1

ED2

ED3

PTR

1

IND/001,PAK/008

 

 

PTR

2

 

SRI/DMK

 

PTR

3

 

 

AUS/101,USA/234

 

I found similar query here but it was power query solution but I am looking DAX solution.

 

https://community.powerbi.com/t5/Desktop/Multiple-Rows-into-Multiple-Columns/m-p/543527

 

 

Any advise please.

 

4 Replies

    • Saxon10's avatar
      Saxon10
      Post Prodigy

      Hi,

      Thanks for your reply and help.

       

      I would like to get the area according to the type but the current solutions the area showing top of the row.

       

      Can you please advise.

       

      This is I want get it based on my data.