cancel
Showing results for 
Search instead for 
Did you mean: 

Transformation of Rows to Column in HANA

Former Member
0 Kudos

Hi All,

I have a requirement of converting rows to columns.

For Ex -

I have date in my view as below -

My requirement is I want to convert the above in columnar structure as -

Please suggest how can I achieve the same.

Regards,

Nakul Kothari

+9987039379

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Please look into Restricted Measures in Analytic Views. You can find details in the HANA Data Modeling guide. I suspect these will be your best bet.

former_member182114
Active Contributor
0 Kudos

Hi Nakul,

It's very well explained here:

Regards, Fernando Da Rós

Former Member
0 Kudos

Hi Fernando,

The example you have given transposes column to rows.

However, my requirement is just the opposite. Not able to find any efficient solution for it.

Regards,

Nakul Kothari

former_member182114
Active Contributor
0 Kudos

Hi Nakul,

There have the points you need to reach your goal, see what would be in SQL:


select

  status_start_date,

  sum(s1) as s_Initiated,

  sum(s2) as s_cleared,

  sum(s3) as s_scf_associated,

  sum(s4) as s_scf_supervisor

from (

select status_start_date,count(*) as s1,0 as s2,0 as s3,0 as s4 from _sys_bic."Spend/AT_GES_CLAIMS_FLAG_DTLS"

where status_start_date between '2014-01-24' and '2014-01-30' and status='Initiated'

group by status_start_date

union all

select status_start_date,0 as s1,count(*) as s2,0 as s3,0 as s4 from _sys_bic."Spend/AT_GES_CLAIMS_FLAG_DTLS"

where status_start_date between '2014-01-24' and '2014-01-30' and status='Cleared'

group by status_start_date

union all

select status_start_date,0 as s1,0 as s2,count(*) as s3,0 as s4 from _sys_bic."Spend/AT_GES_CLAIMS_FLAG_DTLS"

where status_start_date between '2014-01-24' and '2014-01-30' and status='Seek Clarification from Associate'

group by status_start_date

union all

select status_start_date,0 as s1,0 as s2,0 as s3,count(*) as s4 from _sys_bic."Spend/AT_GES_CLAIMS_FLAG_DTLS"

where status_start_date between '2014-01-24' and '2014-01-30' and status='Seek Clarification from Supervisor'

group by status_start_date

)

group by status_start_date

;

Regards, Fernando Da Rós