# Need help in DQL to expand columns

**URL:** <https://community.dynatrace.com/t/need-help-in-dql-to-expand-columns/51335>\
**Category:** DQL\
**Tags:** dql, notebooks, logs\
**Created:** [April 23, 2025, 9:37am UTC](https://community.dynatrace.com/t/need-help-in-dql-to-expand-columns/51335 "2025-04-23T09:37:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imsummii](https://avatars.discourse-cdn.com/v4/letter/i/b5a626/32.png) [@imsummii](https://community.dynatrace.com/u/imsummii)\
**Post date:** [April 23, 2025, 9:37am UTC](https://community.dynatrace.com/t/need-help-in-dql-to-expand-columns/51335/1 "2025-04-23T09:37:17Z")

</div>

Hello Community,

We need help in one of the DQL to expand one of the columns which are in JSON. We got to this final column from nested jsons and previously in the same query used “fieldsFlatten”&nbsp; to&nbsp;flatten a single nested row to many rows. But the flatten rows are not getting expanded. This is required to create a dashboard for the data.

Query::

fetch logs  
| filter matchesValue(aws.account.id, “674210405359”)  
| filter dt.security\_context == “14025”  
| filter aws.log\_group == “/mcs-ops-remote-patching/”  
| fieldsKeep content  
| parse content, “JSON:data\_payload”  
| fieldsFlatten data\_payload, depth: 10

| expand data\_payload.StepExecutions

| fields data\_payload.StepExecutions, data\_payload.Account\_Id, data\_payload.Region\_Name, data\_payload.ProductID  
| fieldsFlatten data\_payload.StepExecutions, depth: 10  
| filter data\_payload.StepExecutions.StepName == “PostPatching\_notification” or data\_payload.StepExecutions.StepName == “patch\_summary”

| fieldsKeep data\_payload.StepExecutions.Outputs.patchsummary  
| expand data\_payload.StepExecutions.Outputs.patchsummary, limit: 10

 ![Output of the query .jpg](https://global.discourse-cdn.com/dynatrace/original/3X/2/0/20ac98a0b093dd04194a918a96af9a51b78d82e2.jpeg)  
 ![json data of one of the row.jpg](https://global.discourse-cdn.com/dynatrace/original/2X/1/148af04afed00d9b537eb197e7c683f6947574fa.jpeg)

---

<div class="post-metadata">

**Author:** ![krzysztof\_hoja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/krzysztof_hoja/32/34625_2.png) [@krzysztof\_hoja](https://community.dynatrace.com/u/krzysztof_hoja)\
**Post date:** [April 23, 2025, 7:35pm UTC](https://community.dynatrace.com/t/need-help-in-dql-to-expand-columns/51335/2 "2025-04-23T19:35:06Z")

</div>

_ **fieldsFlatten** _ does not “flatten a single nested row to many rows”. _ **expand** &nbsp;_command&nbsp;can expand single field being an array into multiple rows.

data\_payload.StepExecutions.Outputs.patchsummary seems to be just object (or maybe string representing object?), so applying _ **expand** _ on it does not change anything
