cancel
Showing results for 
Search instead for 
Did you mean: 

SAP HANA Calculation view. Incorrect Count

rezm
Discoverer
0 Kudos

Good day!

I am struggling to understand how count Aggregation works in Data Preview.

Context:

1) I am repeating the BW logic of Asset Accounting 0FIA_DS13 (transformations + routines) in Calculation views. In the end I want to compare result in InfoCube and in my CV. If I developed CV correctly, then data must be the same. I created a small CV which gathers data from both BW infocube table and my CV. I added a calculated column "Source" so I distinguish from what source each row came.

rezm_0-1712489161056.png

2) I make a Data Preview for node Aggregation_1 and put Source and 0FISCPER into Label axis area:

16 rows for BW and 12 rows for CV. That is correct. 

rezm_1-1712489525652.png

3) Now I move 0FISCPER into Values Axis. I expect something like this:

BW - 16

CV - 12

And get this

rezm_2-1712489594643.png

4) I tried to use Keep Flag on 0FISCPER. It worked. Got the correct result. But then I move to the next field and I get incorrect result.

With Keep_Flag on 0FISCPER

rezm_3-1712489715913.png

0FISCYEAR in my case exist only 1 - 2013. The result is incorrect

rezm_5-1712489764202.png

If select Keep Flag "true" on 0FISCYEAR aswell the result will be the same - 16 and 12 instead of 1 and 1.

The Keep Flag option works correctly only in case when I manually, every time, switch it on for 1 field and switch it on off for all others. 

My required result is (an example in excel with pivot table):

rezm_6-1712490633657.png

Or a least I want to see Source and 1 field, but recalculating correctly every time I change that field.

Thank for help.

 

Regards,

Rezm

 

 

 

Accepted Solutions (0)

Answers (2)

Answers (2)

nachtaktiv
Participant
0 Kudos

HANA is simplifying/optimizing the SQL-statement at every node, to the requested fields only. 
Try to add more keep-flags to the other key-fields of your source
and try to set the keep-flag on others levels in your calculation view,
so that more details must be read.
Check your aggregated fields in your aggregation nodes and/or switch from aggregation to projection.

rezm
Discoverer
0 Kudos

I can write a SQL  to this CV and get the result I need: 

 

SELECT  "SOURCE", count (distinct  "0FISCPER"), count(distinct "0FISCYEAR")
FROM "_SYS_BIC"."***/BW_HANA_DIFF"
GROUP BY "SOURCE"

rezm_0-1712576389694.png

This can work for me as a workaround, but I would like to know if I can repeat it in Node's Data Preview.