Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

Else Condition date

[EXP_F_EXPENSE]:

LOAD*,

  Num#(Date("DISTRIBUTED_DT",'YYYYMMDD')) AS DATE_KEY,

  EXP_CD+EXP_COST_SUBCATEGORY_CD AS HIER_KEY_TableJoin;

SELECT "RECORD_DATE_KEY",

  "COMPANY_KEY",

  "ACFT_KEY",

  "AIRCRAFT_UNIT_KEY",

  .....

  "DISTRIBUTED_DT",

    "APPROVED_DT"

FROM "MICROS_APP_TEAM"."EXP_F_EXPENSE";

[EXP_D_DATE]:

SELECT "DATE_KEY",

  "COMPANY_KEY" AS "COMPANY_KEY_DATE",

    "DATE_VALUE",

  "DAY_OF_WEEK_NBR",

  "DAY_OF_WEEK_DESC",

  "DAY_OF_WEEK_SHORT_DESC",

  "WEEK_END_FLG",

  "WEEK_IN_MONTH_NBR"

...

From DIM_DATE

Above script i have join like DATE_KEY=DATE_KEY

Now my question

In my report i have prompt (Distributed Date and Approved Date)

When i select Distributed date in my prompt then my join should be

Fact.DISTRIBUTED_DT=DIM.DATE_KEy

When i select Approved Date in my prompt my join should be

Fact.APPROVED_DT=DIM.DATE_KEy

How can i achieve this.Some time Distributed date join and some time Approved date join.

Can you please help

1 Reply
florentina_doga
Contributor III

Re: Else Condition date

try this

[EXP_F_EXPENSE]:

LOAD*,

  Num#(Date("DISTRIBUTED_DT",'YYYYMMDD')) AS DATE_KEY,

  EXP_CD+EXP_COST_SUBCATEGORY_CD AS HIER_KEY_TableJoin;

SELECT "RECORD_DATE_KEY",

  "COMPANY_KEY",

  "ACFT_KEY",

  "AIRCRAFT_UNIT_KEY",

  .....

  "DISTRIBUTED_DT"

FROM "MICROS_APP_TEAM"."EXP_F_EXPENSE";

concatenate ([EXP_F_EXPENSE])

LOAD*,

  Num#(Date(""APPROVED_DT"",'YYYYMMDD')) AS DATE_KEY,

  EXP_CD+EXP_COST_SUBCATEGORY_CD AS HIER_KEY_TableJoin;

SELECT "RECORD_DATE_KEY",

  "COMPANY_KEY",

  "ACFT_KEY",

  "AIRCRAFT_UNIT_KEY",

  .....

    "APPROVED_DT"

FROM "MICROS_APP_TEAM"."EXP_F_EXPENSE";

[EXP_D_DATE]:

SELECT "DATE_KEY",

  "COMPANY_KEY" AS "COMPANY_KEY_DATE",

    "DATE_VALUE",

  "DAY_OF_WEEK_NBR",

  "DAY_OF_WEEK_DESC",

  "DAY_OF_WEEK_SHORT_DESC",

  "WEEK_END_FLG",

  "WEEK_IN_MONTH_NBR"

...

From DIM_DATE