cancel
Showing results for 
Search instead for 
Did you mean: 

Count depending of condition in cds

naotoxxx
Participant
0 Kudos

Hello partners @abapers , i have a little problem but right not i haven't find any solution. I created a cds view , lets say

 

 

@AbapCatalog.viewEnhancementCategory: [#NONE]
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Modelo ventas Sellout'
@Metadata.ignorePropagatedAnnotations: true
@ObjectModel.usageType:{
    serviceQuality: #X,
    sizeCategory: #L,
    dataClass: #MIXED
}
@Metadata.allowExtensions: true
@VDM.viewType: #CONSUMPTION
@OData.publish: true

@Search.searchable: true
@Analytics.query: true
@Analytics.dataExtraction.enabled: true

define view entity Z_M_SELLOUT_VD
  as select from Z_M_SELLOUT_VD_2
{
    @Consumption.filter:{mandatory: true, selectionType: #INTERVAL, multipleSelections: false}
    fkdat,
    @Consumption.filter:{mandatory: false, multipleSelections: false}
    @Consumption.filter.defaultValue : 'EC01'
    bukrs,
    kunag,
    zmonto_netos,
    zmonto_menge,
    zsemana
}

 

 

Now, i need to add a new field , this field is the number(count) of kunag when zmonto_netos > 10000

Maybe i could use , this is my first cds so i'm a little lost

@AnalyticsDetails.query.formula : 'CASE WHEN $projection.relative_margin > 20 THEN revenue ELSE 0 END'
  1 as revenue_for_margin_gt_20 

Any suggestions?

Accepted Solutions (0)

Answers (0)