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
Anonymous
Not applicable

How to pivot column keeping null?

Hi,

I'm working with table created by Json data after transforming the data one of the column contains records and whitin the records it contains List of key value pairs. However in some rows there are no "Record" values.

 

1.png>After I click on that expand at top right i get this>>2.png

 

Now within the list there are multiple records and each record has multiple Key value pairs of data.

So in PowerBI I first expanded the List which gave me multiple rows of records and then I expanded the record to just two key value pairs. After I do that now when I try to Pivot the data of those two columns I get the error 

"Expression.Error: We cannot apply operator < to types Record and Record.
Details:
Operator=<
Left=[Record]
Right=[Record]"

 

I'm assuming thats because there are null values in some columns at the begineeing and thus the left is not matching the right can someone advise how to fix this?

5 REPLIES 5
v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

I wonder what the data structures of the lists are like. It is hard to understand the problem without some sample data. Do mask sensitive data before uploading. Thanks.

 

Best Regards

Allan

Anonymous
Not applicable

Whats happening I post a reply and when I refresh the page the reply disappear 😞

 

Hi @Pragati11 @v-alq-msft,

Please find the sample pbix attached. link 

 

Please note the datatype of the data column is Json and there are few coumns where there is no data and when thats the case I would like to keep it null/empty.

 

Below is the table how I have right now 

idnamedata
1a 
2b{"CustomAttribute":[{"ExternalId":"123","Name":"Project Number","Data":"123456789"},{"ExternalId":"124","Name":"Purpose","Data":"ID"},{"ExternalId":"125","Name":"Approver","Data":"John Doe"},{"ExternalId":"126","Name":"Internal/external","Data":"Internal"},{"ExternalId":"127","Name":"person Name"}]}
3c{"CustomAttribute":[{"ExternalId":"123","Name":"Project Number","Data":"123456790"},{"ExternalId":"124","Name":"Purpose","Data":"BD"},{"ExternalId":"125","Name":"Approver","Data":"John Doe"},{"ExternalId":"126","Name":"Internal/external","Data":"Internal"},{"ExternalId":"127","Name":"person Name","Data": "Henry Doe"}]}
4d{"CustomAttribute":[{"ExternalId":"123","Name":"Project Number","Data":"123456791"},{"ExternalId":"124","Name":"Purpose","Data":"CD"},{"ExternalId":"125","Name":"Approver","Data":"John Doe"},{"ExternalId":"126","Name":"Internal/external","Data":"Internal"},{"ExternalId":"127","Name":"person Name","Data": "Patrick Doe"}]}

 

 

And this is how I want the above table to be converted to

 

idnameProject NumberPurposeApproverInternal/externalperson Name
1a     
2b123456789IDJohn DoeInternal 
3c123456790BDJohn DoeExternalHenry Doe
4d123456791CDJohn DoeInternalPatrick Doe
Pragati11
Super User
Super User

Hi @Anonymous ,

 

Can you try replacing null with some value like "No Value" (if other values are text) or 0 (if other values are numeric)?

 

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!!

Anonymous
Not applicable

Hi @Pragati11 ,

 

I tried to pivot with null and got the below error

Expression.Error: We cannot convert the value null to type Text.
Details:
Value=
Type=[Type]

 

but when I replace the null with anything else and try again i get the below error

 

Expression.Error: We cannot apply operator < to types Record and Record.
Details:
Operator=<
Left=[Record]
Right=[Record]

 

Hi @Anonymous ,

 

Just wanted to mention here as it is hard to comment further without seeing any sample data or your pbix file. It will be helpful.

 

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!!

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.