Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Need counts not to aggregate

$
0
0

Hi

 

I have this scenario where I need the counts ( like fleet count or headcount)  not to aggregate when rolled to a upper level

 

for example : The counts are now at the lowest granularity of months

1.JPG

 

but when I remove months , the counts roll up ( which is incorrect )

2.JPG

 

 

 

The logic I need is If I roll up from months to quarter , I need the counts of the max month within the quarter

 

[Q1 = apr, may, jun and q2 = july , aug, sep ...]

 

so Q1 should have the count of June ( max month of q1)

and Q2 should have the count of the max month ( max month of data present in Q2)

 

so the correct result is like this ( but this approach leads to a proliferation of named measures , so not acceptable )

 

the current period count or Q1 etc counts have been done by using a scripted view with logic

 

CASE WHEN PERIOD = (SELECT MAX(PERIOD)  FROM "FLEET"."FLEET_COUNT" WHERE

QUARTER = 'Q1' AND FISCAL_YEAR = (SELECT MAX(FISCAL_YEAR) FROM "FLEET"."FLEET_COUNT" ))

THEN SUM(FLEET_COUNT) ELSE 0 END AS Q1_COUNT

 

3.JPG

 

 

What is a better way to do it in HANA. Head Count or fleet counts is a common BI / KPI scenario . I been looking at blogs/comments by Ravindra Channe / Jody Hesch for exception Aggregation or group by sets , but could not find a solution yet..

 

Would be super super super grateful for guidance !!!

 

Rishi


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>