cancel
Showing results for 
Search instead for 
Did you mean: 

Missing values from calculated column

Former Member
0 Kudos
173

Can anyone help me with the problem i'm facing.

I have a simple calculation view as shown below.

In the join I add one calculated column to my dataset.

MEDIATYPE with a hardcoded value 'Call'

When I preview the result of my view it looks ok, so far so good.

But when I use the distinct values in this same data preview it gives a result I did not expected.

0 values found

Also when I open this view in SAP Lumira I get a empty column

Can anyone tell me what i'm doing wrong or how I can fix my problem.

Thx

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

Hey Jacques

can you review the SQL statement that is used for the DISTINCT values?

If you execute this SQL in the SQL console, is the result set still empty?

- Lars

Former Member
0 Kudos

Hello Lars,

Then still the result of the attribute MEDIATYPE is empty.

Our best guess, because we using a calculation view and this attribute is not derived from a table and also not used as a measure the calculation engine is not seeing/ showing this attribuut.

I did the same in a attribute view and there its working fine.

former_member226419
Contributor
0 Kudos

Hi,

From where are you fetching this MEDIATYPE value in your calculation view?

BR

Sumeet

Former Member
0 Kudos

Hello Sumeet,

MEDIATYPE is a calculated column created in the view (join note) mentioned above.

It gets a default/ hardcoded value 'Call' for al records.

- Jacques

lbreddemann
Active Contributor
0 Kudos

Hi Jacques,

your guess is correct.

The calculated columns work based on the request of records from the underlying nodes that run data into a projection node.

If there are no records being fed into the projection node, no expression evaluation can be done.

- Lars

former_member226419
Contributor
0 Kudos

Lars,

Can you please explain with dummy example. I tried the same with projection node but still I am getting blank values for distinct column.

BR

Sumeet

Former Member
0 Kudos

Hello Lars,

I agree with Sumeet, we tried all different scenario's.

We also wrote the result of the view in a persistent table and then it gives back the correct/ expected result (We can see the 'Call' value then).

- Jacques

lbreddemann
Active Contributor
0 Kudos

Well, that's what it is doing.

Look, if the query doesn't request any columns from the base data sources  - tables or other information models - then the calculation engine removes those columns (column pruning).

If no columns of a underlying data source are requested, there is no way that any records/tupels are being handed over to the next node.

The next node in this case is your projection where the computed column is added to every tupel that got fed into the projection node.

No columns from the base table selected means no tupels being fed into the projected which means: no computed columns to be added.

You could imagine this as an inner join between your base columns and the computed columns.

If no base columns are there to be joined/glued to, then you don't get any records back.

Hope this makes it a bit clearer.

- Lars

Former Member
0 Kudos

Hello Lars,

Thanks for you reply. I understand whats its doing now and to let it work I created a DUMMY value in the lowest projection. In the join node (where MEDIATYPE is created) I made this expression IF("DUMMY' =1, 'Call', 'Call'). This isnt a pretty solution but it works.

- Jacques

former_member226419
Contributor
0 Kudos

Hi  Jacques,

Better than this I think if you call your attribute view having calculated column in calculation view then that column will act as a normal column in your calc view and you will be able to count distinct on the same . I think that also will be one alternate solution , I tried this way and its working fine.

BR

Sumeet

Former Member
0 Kudos

Hello Sumeet,

Thanks for your reaction and this works fine indeed.

Another option is to use a cross-reference table, thats also a usefull solution for us.

-Thx

-Jacques