Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sql data load issue - pivoting

Hi,

I have connected Qlik sense with a database and want to load the following data. The Sql query is below. However I am having trouble loading the data due to error in the following codes. Can someone suggest why this doesn't work?

Thanks.

    LOAD ID,

        ComponentSales,

        Sales,

        Territory,

        Volume,

        ComponentName,

        "Type"

    SQL with relevantComponents as

    (

                select [ComponentName], [Value], [Type] from SALESREPORTING.dbo.Components

                where ([ReportRunId] = 901) AND ([AggregationId] = 'MainOneMonth')

    )

    SELECT *

    FROM relevantComponents

    pivot (

                max([Value])

                for [Type] in ([ComponentSales], [Sales], [Territory], [Volume])

    )

                as datapivot;

5 Replies
Gysbert_Wassenaar

Try adding a semicolon after "Type". A preceding load needs to be terminated with a ; character.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert, thank you for the suggestion. I've added a semicolon after type but it still does not load... Can you see anything else wrong with it?

Gysbert_Wassenaar

I don't see a field ID anywhere in the sql statement.


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert, sorry I don't understand... aren't ID, ComponentSales, etc field IDs?

Thanks.

Gysbert_Wassenaar

   LOAD ID,

        ComponentSales,

        Sales,

        Territory,

        Volume,

        ComponentName,

        "Type"

You tell Qlikview to load a field called ID. Where does that field come from? I don't see it in the sql statement.


talk is cheap, supply exceeds demand