Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Help in set analysis

Hello I have t pivot table

I want to show the customers not served in the selected month and year

I was able to get them using the following expression:

CustomerCode = E(

  {1

  <

  TrxType={'Sales'}

  ,TrxDate = P(TrxDate)

  ,Customer_Default_Salesman2 = P(Customer_Default_Salesman2)

  ,CusNum = {"=Sum({1<TrxType={'Sales'},TrxDate = P(TrxDate),Customer_Default_Salesman2 = P(Customer_Default_Salesman2)>} ValueUSD)>0"}

  >

  } CustomerCode)

the above expression gets the customers that are not included in the set where there is sales transactions with valueUSD >0

this is fine and I was able to get the last invoice for these customers as follows:

= max(

  {

  <

  CustomerCode = E(

  {1

  <

  TrxType={'Sales'}

  ,TrxDate = P(TrxDate)

  ,Customer_Default_Salesman2 = P(Customer_Default_Salesman2)

  ,CusNum = {"=Sum({1<TrxType={'Sales'},TrxDate = P(TrxDate),Customer_Default_Salesman2 = P(Customer_Default_Salesman2)>} ValueUSD)>0"}

  >

  } CustomerCode)

  ,TrxType={'sales'}

  ,YEAR=,MONTH=,MONTH_NUM=,MONTH_YEAR=,DAY=

  ,TrxDate={'<=$(vEOM_LastMonth)'}

  >

  }TrxDate

  )

everything is fine so far

but what I want now is to calculate the amount of the transactions of these customers in the max invoice date

I think I have problem in the double quotation in the part where I wrote CusNum = {"=Sum({1<TrxType={'Sales'},TrxDate = P(TrxDate),Customer_Default_Salesman2 = P(Customer_Default_Salesman2)>}

Please advise

I can walk on water when it freezes
1 Reply
ali_hijazi
Partner - Master II
Partner - Master II
Author

Actually I tried the following expression to calculate the amount of the invoices whose date is max date of the not-served-customers but I get nulls

suM(

  {

  <

  CustomerCode = E(

  {1

  <

  TrxType={'Sales'}

  ,TrxDate = P(TrxDate)

  ,Customer_Default_Salesman2 = P(Customer_Default_Salesman2)

  ,CusNum = {"=Sum({1<TrxType={'Sales'},TrxDate = P(TrxDate),Customer_Default_Salesman2 = P(Customer_Default_Salesman2)>} ValueUSD)>0"}

  >

  } CustomerCode

  )

  ,TrxType={'sales'}

  ,YEAR=,MONTH=,MONTH_NUM=,MONTH_YEAR=,DAY=

  ,TrxDate={"=TrxDate=max(

  {

  <

  CustomerCode = E(

  {1

  <

  TrxType={'Sales'}

  ,TrxDate = P(TrxDate)

  ,Customer_Default_Salesman2 = P(Customer_Default_Salesman2)

  ,CusNum = {'=Sum({1<TrxType={'Sales'},TrxDate = P(TrxDate),Customer_Default_Salesman2 = P(Customer_Default_Salesman2)>} ValueUSD)>0'}

  >

  } CustomerCode)

  ,TrxType={'sales'}

  ,YEAR=,MONTH=,MONTH_NUM=,MONTH_YEAR=,DAY=

  ,TrxDate={'<=$(vEOM_LastMonth)'}

  >

  }TrxDate

  )

  "}

  >

  }if(vSelectedCurrency='USD',ValueUSD,ValueLBP))

I can walk on water when it freezes