green = SUM(Bypassed) where Service = ‘Default’
blue= SUM(Bypassed) where Service <> ‘Default’
Table:
Proxy | Service | Bypassed | Client | Server
A | Default | 2 | 4 | 5
A | NULL | 6 | 12 | 23
B | Default | 3 | 8 | 15
B | NULL | 1 | 3 | 11
For Proxy A: 2 / (16 + 6)
For Proxy B: 3 / (11 + 1)
I’ve tried to create two different measures SUM(bypassed) where Service = ‘Default’ and SUM(bypassed) where Service <> ‘Default’ and a third measure with
Look at the generated SQL code and you will see that the WHERE clauses of your measures are logically ANDed (TRAFFIC_DIM.SERVICE = ‘Default’ AND TRAFFIC_DIM.SERVICE <> ‘Default’) , thereby retrieving an empty result set.
I dont see the where clauses at all in de generated SQL in WEBI
SELECT
DATE_DIM.YEAR_MONTH_NUMBER,
DATE_DIM.YEAR_MONTH_ABBR,
DEVICE_DIM.DEVICE_NAME_PRTG,
CASE WHEN ( sum(TRAFFIC_FAC.BYPASSED_BYTES) ) <=0
THEN 0
ELSE
( sum(TRAFFIC_FAC.BYPASSED_BYTES) ) / (( sum(TRAFFIC_FAC.INTERCEPTED_CLIENT_BYTES) ) + ( sum(TRAFFIC_FAC.BYPASSED_BYTES) ))
END
FROM
TRAFFIC_DIM INNER JOIN TRAFFIC_FAC ON (TRAFFIC_FAC.SVC_TRAFFIC_KEY=TRAFFIC_DIM.SVC_TRAFFIC_KEY)
INNER JOIN ACCOUNT_DIM ON (TRAFFIC_FAC.ACCOUNT_KEY=ACCOUNT_DIM.ACCOUNT_KEY)
INNER JOIN DEVICE_DIM ON (DEVICE_DIM.DEVICE_KEY=TRAFFIC_FAC.DEVICE_KEY)
INNER JOIN DATE_DIM ON (DATE_DIM.DATE_KEY=TRAFFIC_FAC.DATE_KEY)
WHERE
ACCOUNT_DIM.ACCOUNT_CODE = 'BSS'
GROUP BY
DATE_DIM.YEAR_MONTH_NUMBER,
DATE_DIM.YEAR_MONTH_ABBR,
DEVICE_DIM.DEVICE_NAME_PRTG
That is because for your final measure you are using @SELECT, which as the name suggests takes only the SELECT portion of measure 1 and measure 2.
Again, define your base measures (Default Bypassed Bytes Sum & Non Default Bypassed Bytes Sum ) using CASE WHEN … SQL syntax, no WHERE clause.
A) @SELECT formula references only the SELECT definition, therefore the WHERE definition is missing.
B) Create a query with only measure 1 and measure 2 and look at the generated SQL code. You will see the conflicting WHERE clause.
Solution:
Define measure 1 such as:
Measure 1: Default Bypassed Bytes Sum
Projection: SUM
Select:
SUM
( CASE WHEN TRAFFIC_DIM.SERVICE = ‘Default’
THEN TRAFFIC_FAC.BYPASSED_BYTES
END
)
Do that for measure 2 as well, and you will see how beautifiul measure 3 will work, finally.