Forum Discussion

amilpbi's avatar
amilpbi
Frequent Visitor
1 year ago
Solved

How to deal with Irregular columns in JSON from REST API

Beginner to power bi and Rest Api, We have this REST API from client that is connected to Sql Server to fetch user data demographics(like responedent age, respondent gender, etc..) and JSON model(co...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Thanks for the reply from rajendraongole1 , please allow me to provide another insight:

    Hi, amilpbi 
    Thanks for reaching out to the Microsoft fabric community forum.

    1.Here is an example of how I converted JSON data into a table, which I hope will be helpful to you:

    1.Here is an example of how I converted JSON data into a table, which I hope will be helpful to you:
    let
        Source = Json.Document("{""EventId"":12345,""EventType"":""Error"",""IsCritical"":1,""StartTime"":""2023-10-01T12:00:00"",""EndTime"":""2023-10-01T13:30:00"",""DurationMinutes"":90}"),
        Table = Table.FromRecords({
            [EventId = Source[EventId], EventType = Source[EventType], IsCritical = Source[IsCritical], StartTime = Source[StartTime], EndTime = Source[EndTime], DurationMinutes = Source[DurationMinutes]]
        }),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Table, {}, "Attribute", "Value")
    in
        #"Unpivoted Columns"

    2. Secondly, here is the official documentation for processing data in Power Query:

    Common tasks include:

    Removing duplicates:

    Working with duplicate values - Power Query | Microsoft Learn

    Changing data types:

    Data types in Power BI Desktop - Power BI | Microsoft Learn

     

    3.Next, regarding visualization, you can refer to the following:

    For political inclination analysis, you can create a pie chart to show the proportions of support, opposition, and neutrality. This allows you to visually see the distribution of different political inclinations.

    For age group analysis, you can use a stacked bar chart to show the distribution of different political inclinations by age group. This allows you to compare the political inclinations of different age groups.

    For trend analysis, you can use a line chart to show the trend of swing or stable inclinations over different years. This allows you to observe the changes in political inclinations over time.

    For more details, please refer to:

    Combo chart in Power BI - Power BI | Microsoft Learn

    Doughnut charts in Power BI - Power BI | Microsoft Learn

    Key influencers visualizations tutorial - Power BI | Microsoft Learn

     
    Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
     

    Best Regards,

    Leroy Lu

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