cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation view model - Transpose values

ssurampally
Active Contributor
0 Kudos

Hi Experts,

I need to create a report on EQUI, KSML, AUSP tables, to list out the equipment which meets the selection criteria on characteristics and it's values.

I am able to make the join conditions fine, but during testing it is noticed that characteristic values in AUSP are stored in one column,

so it will be as below,

EquipmentEquipment typeCharacteristicCharacteristic value
400010BridgeChar 1Char value 1
400010BridgeChar 2Char Value 2
400010BridgeChar 3Char Value 3

With that, I am unable to apply the selection criteria on char 1 and char 2 value combination, for this I will have to store the data in different columns, one column for each characteristic value. as below,

EquipmentEquipment typeChar 1Char 2Char 3
400010BridgeChar 1 ValueChar 2 valueChar 3 Value

there is no other table which stores the data in this way.So I will have to get the data available in this format, during HANA modeling. I created 3 calculated columns and used simple formulas to populate the values,

     char 1 formula   is if characteristic = char 1 then update char 1 value


the output is displayed in the following way,

EquipmentEquipment typeChar 1Char 2Char 3
400010BridgeChar 1 valueBlankBlank
400010BridgeBlankChar 2 ValueBlank
400010BridgeBlankBlankChar 3 value

But I would need to display them in one row for report on this model.

Can you suggest me the best way to do the transpose of rows to columns and make them in one row?  is there a way to achieve by doing any other projections and aggregations in the calculation view?  Please let me know.

Accepted Solutions (1)

Accepted Solutions (1)

former_member200930
Participant
0 Kudos

Please use STRING_AGG function and go with scripted calculation view, not graphical calculation view.

Please check following link for more details.

http://help.sap.com/saphelp_hanaplatform/helpdata/en/20/a4389775191014b5a6bf2ccc0df2ed/content.htm#l...

ssurampally
Active Contributor
0 Kudos

Hi Vikram, STRING_AGG function doesn't make sense, I am not doing any aggregation on rows, it is all characteristics.

I will explore more on Scripting, using loop or similar statements to get this requirement.

if any one has done this already, please share your inputs.

Former Member
0 Kudos

Hi Sreekanth,

You can get one row instead of multiple using Aggregation node in graphical calculation view.

if you want this model as dimension, then add an aggregation node before default projection.

Add all your calculated columns as measures to aggregation node output and change aggregation type to 'MAX'

Now in your default projection add them as attributes to semantics.

Regards,

Venkat N.

ssurampally
Active Contributor
0 Kudos

this works fine for values which are defined as decimals and integers, there are characteristic values with varchar type also, I am getting the multiple rows for those ones.

ssurampally
Active Contributor
0 Kudos

Hi Venkat,

for the non-numeric ones I used the aggregation type 'Count' seems to be working. just playing round, not sure how exactly working.  I will do the detailed test and update you with the final result.

Former Member
0 Kudos

Hi Sreekanth,

MAX function should work fine for varchar values too. Please make sure you have selected MAX as aggregation type.

Sometime even though we select MAX aggregation type, once you activate or click else where in HANA studio. system changes that to aggregation type next to MAX in settings.

Please check that.

Regards,

Venkat N.

ssurampally
Active Contributor
0 Kudos

You are right, aggregation type 'Max' is working fine for char values also. now all the values are in one line.  When I first tested it, for reason I see the char values in multiple lines. Anyway it is good now.

Thank you.

Answers (0)