on 11-16-2015 7:27 PM
Hello,
I'm trying to replicate a calculation in the Universe that is currently being done at the report level. Ideally, this would be done in one measure in the Universe. What I curently have at the report level is =Sum([Sales_GC_Net Value] Where ([Sales Order Type Id] InList ("KE";"TA";"ZEDI";"ZWEB"; "ZCN"; "L2")) - [Sales_GC_Net Value] Where ([Sales Order Type Id] InList ("RE"; "G2")))
This is a standard calculation at my company and I'd like to define it in the semantic layer. Any thoughts?
Thanks,
Sam
Hi,
if your database supports the case stetement (or something else similar to if):
First Measure sums up the sales value when the order type is in the first list of values
sum(CASE WHEN Sales_Order_Type_ID IN ('KE','TA','ZEDI','ZWEB','ZCN','L2') THEN Sales_GC_Net_Value ELSE 0 END)
Second Measure sums up the sales value when the order type is in the second list of values.
sum(CASE WHEN Sales_Order_Type_ID IN ('RE','G2') THEN Sales_GC_Net_Value ELSE 0 END)
Third measure: First Measure - Second Measure, if you want to provide first and second measure as separate objects.
Or simply all in one go:
sum(CASE WHEN Sales_Order_Type_ID) IN (first list) THEN Sales_GC_Net_Value ELSE 0 END) - sum(CASE WHEN Sales_Order_Type_ID) IN (second list) THEN Sales_GC_Net_Value ELSE 0 END)
Martina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
one option is to first create two measure objects.
measure 2:
Select part: Sum([Sales_GC_Net Value]
Where clause:[Sales Order Type Id] IN ('KE','TA','ZEDI','ZWEB', ',ZCN', 'L2')
measure 2:
Select part:sum(Sales_GC_Net Value)
Where clause:([Sales Order Type Id] IN ('RE', 'G2')
Final Object:
Select part: Sum(measure 1-measure 2)
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.