qlikview

I need only one manager to correspond to each branch + client bundle, otherwise after Joining, I will get extra lines in the report


I have a large table with individual shipments and a lot of data added to it earlier. I want to add another column there using left join. I need to add the names of managers to each shipment, I take them from the list of managers in the client card in 1c. there each client has several managers, for different branches. I need only one manager to correspond to each branch + client bundle, otherwise after Join, I will get extra lines in the report, since Join will create them for additional managers. How can I set this up?

For example, I tried this option, but qlikview just doesn't accept the syntax.

ПРобовал разные варианты, типа: 

tmp20:
LOAD
    фЗаявкаЗаказчикаЗаказчикID,
    KAM,
    PODRAZDID,
        PODRAZDID & '-' & фЗаявкаЗаказчикаЗаказчикID AS СцепленноеПоле
Resident tmp16;
DROP Table tmp16;
    
tmp21:
LOAD
    фЗаявкаЗаказчикаЗаказчикID,
    KAM,
    PODRAZDID,
    if(Count(DISTINCT СцепленноеПоле & KAM) > 1, 'Warning', 'Ok') as Warning
Resident tmp20;

Solution

  • You need to add a group by for the count to work, and the DISTINCT modifier doesn't work in the script function COUNT(). The group by will make it distinct, I also removed the field that is not used in IF() to prevent it from creating duplicates.

    tmp21:
    LOAD
      фЗаявкаЗаказчикаЗаказчикID,
      KAM,
      PODRAZDID,
      if(Count(СцепленноеПоле & KAM) > 1, 'Warning', 'Ok') as Warning
    Resident tmp20
    group by 
      фЗаявкаЗаказчикаЗаказчикID,
      PODRAZDID,
      KAM;