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
labuser1235
Helper IV
Helper IV

Pivot creates duplicate values

Hi All,

 

I am trying to create a pivot for different types in a column. However, it creates multiple TIDs based because of the pivot. 

 

I am aware that I can use fill up or fill down so that I can remove duplicate TIDs to get the data right. However, this cannot be done when there is a null value in between and the process fails.

 

Also tried to create different tables and merge based on TIDs. However, this needs multiple duplicate or referenced tables and this fails when there are so many types in the pivot column. 

 

Is there a way where we can achieve without using the above mentioned steps even by calculated columns or any other method required to work on. 

 

DATA

TIDFIDFnameFdata
4431Type-A10
4432Type-B15
4433Type-C25
4434Type-D35
4435Type-E60
4661Type-A100
4662Type-B150
4663Type-C 
4664Type-D350
4665Type-E600
1241Type-A120
1242Type-B140
1243Type-C 
1244Type-D330
1245Type-E660
6511Type-A110
6512Type-B 
6513Type-C220
6514Type-D380
6515Type-E607
7261Type-A 
7262Type-B105
7263Type-C205
7264Type-D30
7265Type-E60

 

 

Expected output:

TIDType-AType-BType-CType-DType-E
4431015253560
466100150 350600
124120140 330660
651110 220380607
726 1052053060

 

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @labuser1235 ,

 

Remove the FID column and pivot Fname column with Fdata as value column should work.

2.PNG

3.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

8 REPLIES 8
v-jayw-msft
Community Support
Community Support

Hi @labuser1235 ,

 

Remove the FID column and pivot Fname column with Fdata as value column should work.

2.PNG

3.PNG

 

Best Regards,

Jay

 

Community Support Team _ Jay Wang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
nandukrishnavs
Super User
Super User

@labuser1235 

 

Try this PQ

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdI7DsMgEEXRrSBqR4JhwGnz20E6y2X6tNl9TOyR3mNSWLJ1QL4aWJaoWuIU8/Y8P+/X6dI/UlwnEzG5dqkgxeTWl6Goyb0vQ6kmj+2lHf9pzRcgDQlI1BAAhgTcMzTslEVdhCBxhCL9idiBIwru4YhjEq1mF5GRKCIA8FkI7uGIM9IwiflHs7jjCAA8h1SBOIKIIxKIuxHrFw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [TID = _t, FID = _t, Fname = _t, Fdata = _t]),
    #"Removed Columns" = Table.RemoveColumns(Source,{"FID"}),
    #"Pivoted Column" = Table.Pivot(#"Removed Columns", List.Distinct(#"Removed Columns"[Fname]), "Fname", "Fdata")
in
    #"Pivoted Column"



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂


Regards,
Nandu Krishna

Pragati11
Super User
Super User

Hi @labuser1235 ,

 

I don't think without edit query transactions if you can get a new table.

If in case you don't want a new table, you can use MATRIX visual,

On matrix visual, you can have TID on Row section, FName under Column section and your summarised metric under VALUE section.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

@Pragati11 I donot want to use matrix visual... I would like the output to get achieved in table visual as I am also clubing it with another data from another tables. 

 

I would like to get that achieved as an output with the help of transformaitons using power query or calculated columns,so that I can use in table visual.

Hi @labuser1235 ,

 

In that case try replacing null values in TID column with a value like "Unknown ID" or "ID Missing".

Then try the usual pivot steps in query editor.

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

amitchandak
Super User
Super User

@labuser1235  Looking at the data this seem like case of matrix with TID as row Fname as column and  Fdata value.

 

I am missing something?

Hi @Amit ,

 

I was expecting to have the output saved in another table with the help of transformations if any with power query so that I can club that with another values in the table visual. Hope this is clear.

amitchandak
Super User
Super User

@labuser1235 , Looking at the data this seem like case of matrix with TID as row Fname as column and  Fdata value.

 

I am missing something?

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.