Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Qlik Analytics Tour 2020 Online. Begins August 10th. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Champion III
Champion III

Re: Apply value to every row in table

How do you identify which quarter you want if missing?

Highlighted
Partner
Partner

Re: Apply value to every row in table

That's the problem....  I don't know either?

Highlighted
Champion III
Champion III

Re: Apply value to every row in table

Is there any date field coming in that excel sheet?

Highlighted
Contributor III
Contributor III

Re: Apply value to every row in table

This one is easier to do with a Cartesian join.

//100 Names with a few having sales

t1:

LOAD * INLINE [

    Name, Sales

    Aaliyah Barr

    Aaron Roac, 70

    Abagail Serran, 300

    Abbey Stei, 100

    Abbigail Gallego, 1000

    Abby Villega

......

    Barrett Edward

];

Quarters:

LOAD * INLINE [

    Quarter

    Q1

    Q2

    Q3

    Q4

];

//Get the unique list of names

Sales:

Load Distinct Name 

Resident t1;

//Use a cartesian product to create 400 rows (100 * 4) bu left joining the Quarters table with no linking field This makes your 400 rows

Left Join (Sales)

Load Quarter

Resident Quarters;

//Add in the sales I spread it out 1/4 to each quarter.  The ones with no sales get a zero

Left Join (Sales)

Load  Name,

      Sales/4

Resident t1;

Highlighted
Contributor III
Contributor III

Re: Apply value to every row in table

Sorry, you wanted zeros not nulls.  Just add a column to the quarter in line load for nosales with a 0 in it. left join that and add it to sales to get sales with a zero.  I will update app

Highlighted
Contributor III
Contributor III

Re: Apply value to every row in table

here you go.

Drop all of the junk table to get rid of the synthetic keys.

Enjoy,

Jack