Pivoting Data

ADX 156 Reputation points
2022-01-27T07:54:51.567+00:00

Hi,

I have my source data in a table called like "Test".

![168951-image.png

and i want data like in the below format

Parameter Name,LHPre-Turn,LHPost-Turn,RHPre-Turn,RHPost-Turn,Wheelset,EventUTCDateTime
FW,31.50912499,31.50912499,30.37000121,30.37000121,1,2022-05-01T12:35:00Z

here in the Parameter name column data first two letters will indicate left hand(LH) or right hand (RH).

Can someone help with the Kusto query by taking example of "Test" table.

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
525 questions
0 comments No comments
{count} votes

Accepted answer
  1. svijay-MSFT 5,226 Reputation points Microsoft Employee
    2022-01-27T18:12:54.433+00:00

    Hello @ADX ,

    Welcome to the Microsoft Q&A platform.

    I tried Kusto Expression :

    test2  
    | extend splitted = split(ParameterName, ' ')  
    | extend Parameter = splitted[1]  
    | extend New = strcat(splitted[0], ' ',SourceQualifierName)   
    | project  Parameter,Equipment,WheelSet,RawValue,New  
    | evaluate pivot(New,sum(RawValue))  
    

    I partially imported the data that you've provided in the question

    Source :

    169148-image.png

    Output :

    169147-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.