Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
felipe_oliveira
Contributor III
Contributor III

how to to make a straight table expression based on a row level?

Hi Qlik masters

I have an issue where an expression from a straight table is not segregated correctly as following:

Table DWH

%Key%Key2AccountDealer_codePeriodDWH.ProgramDWH.Amount$DWH.YearDWH.Month
001111999-0011111Jan-2017X1002017Jan
001333666-0021222Mar-2017Y2002017Mar
002555888-0011555May-2017Y3002017May
003555555-0011555May-2017X1002017May
002222444-0011111Feb-2016Y2002016Feb
001444777-0011444Apr-2017X4002017Apr
003444222-0011444Apr-2017Y1002017Apr

%Key2 = AutoNumber(Dealer_code & Date(Period,'MMYY'))

Table Dealer

%Key2App_idDealer_NameDealer_loc_codeDealer_DateDealer.ProgramDealer.Amount$Dealer.YearDealer.Month
4441B1444Apr-2017Y502017Apr
1113A1111Jan-2017X302017Jan
7774A1111May-2017Y302017May
8885C1333May-2017X102017May
5556E1555May-2017Y302017May
9997C1333May-2016X202016May
5558E1555May-2017X402017May

%Key2 = AutoNumber(Dealer_loc_code & Date(Submittal_dt, 'MMYY'))


The link between the 2 tables is %Key2


I have a straight table where the dimensions are Dealer_Name and DWH.Program.


The expressions are:


Account on Book = count(Account)

On Book $ = sum(DWH.Amount$)

Submittal $ = sum(Dealer.Amount$)


I selecting the following (in yellow) on my list box

Dealer_Name

Dealer.YearDealer.Month
A2017Jan
B2016Feb
CMar
DApr
EMay


Current:

Dealer_NameDWH_ProgramAccount on BookOn Book $Submittal $
EY130070
EX110070


Expected:

Dealer_NameDWH_ProgramAccount on BookOn Book $Submittal $
EY130030
EX110040

    

I have tried many different things to have the Submittal $ segregated by row level like switching the Dimension from DWH_Program to Dealer_Program.

Also, I have tried many different expressions such as:

aggr(sum({$<DWH.Program=p(Dealer_Program)>} Dealer.Amount$),Dealer_Name, DWH.Program) Dealer

.Program

Does anyone can help me?


6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You should also include the program field in your autonumber.

%Key2 = AutoNumber(Dealer_code & Date(Period,'MMYY')&DWH.Program)

%Key2 = AutoNumber(Dealer_loc_code & Date(Submittal_dt, 'MMYY')&Dealer.Program)


Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
felipe_oliveira
Contributor III
Contributor III
Author

Thanks Kaushik for your prompt reply.

The suggested change fix the issue for Dealer E on May, but it messes up the others that were correct before making the change.

For example, if I do the change, for Dealer B that I had before

Dealer_NameDWH_ProgramAccount on BookOn Book $Submittal $
BY110050
BX1400-

turn into

Dealer_NameDWH_ProgramAccount on BookOn Book $Submittal $
BY110050

row for program X disappears.

I would like to show all programs linked to dealer B

Anil_Babu_Samineni

How about this for Submitted %

FirstSortedValue(Dealer.Amount$,Aggr(Sum(Dealer.Amount$), Dealer_Name, DWH.Program))

OR

FirstSortedValue(Dealer.Amount$,Aggr(Sum({<DWH.Program = E({<DWH.Program = {'X'}>}DWH.Program)>}Dealer.Amount$), Dealer_Name))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
felipe_oliveira
Contributor III
Contributor III
Author

Thanks Anil, but it didnt work.

Anil_Babu_Samineni

Try first one and show the image, How Report looks like?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
felipe_oliveira
Contributor III
Contributor III
Author

It looks like this:

Dealer_NameDWH_ProgramAccount on BookOn Book $Submittal $
EY130030
EX110030

Submittal $ shows $30 twice