Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewwizard
Master II
Master II

Showing data dynamically

Hi All,

I have the data with the below columns as shown in attached file. 

EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO,LASTDATE,GETDATE

I want to show the Salary of the employees in a straight table based on JOB on Quarterwise (Q1,Q2,Q3,Q4 based on GETDATE).

Please help me.

When I select:

Q1 >>> Should display Q1 Salary of the year,

Q2 >>> Should display Q1,Q2 Salary of the year,

Q3 >>> Should display Q1,Q2,Q3 Salary of the year,

Q4 >>> Should display Q1,Q2,Q3,Q4 Salary of the year,


Thanks in advance.

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

EMP:

LOAD

     EMPNO,

     ENAME,

     JOB,

     MGR,

    date(HIREDATE,'DD-MMM-YYYY') as HIREDATE,

     SAL,

     COMM,

     DEPTNO,

    LASTDATE,

     Date(GETDATE, 'DD-MMM-YYYY') as GETDATE,

     Year(GETDATE) as Year,

     month(GETDATE) as Month,

     num(Month(GETDATE)) as MonthNo,

     Ceil(month(GETDATE)/3) as QtrNo,

    'Q'& Ceil(month(GETDATE)/3) as Quarter,   

     if(GETDATE > LASTDATE, MGR, ENAME) As [Emp - Current]

FROM

EMP.qvd

(qvd);

Remove all the remaining script.

Now Create a variable

vStartDate = Date(YearStart(Max(GETDATE)), 'DD-MMM-YYYY')

vMaxDate = Date(Max(GETDATE), 'DD-MMM-YYYY')

Now in set analysis use this expression

=Sum({<Year=, Month=, Quarter=, GETDATE={'>=$(=vStartDate)<=$(=vMaxDate)'}>} SAL)

Hope this helps you.

Regards,

Jagan.

View solution in original post

11 Replies
Anonymous
Not applicable

Hi,

You can use below code to populate Qtr and then use this qtr in your expression and filters.

LOAD EMPNO,

     ENAME,

     JOB,

     MGR,

     HIREDATE,

     SAL,

     COMM,

     DEPTNO,

     LASTDATE,

     date(GETDATE) as GETDATE,

     Year((GETDATE))   as [Year],

  Month(GETDATE) as [Month],

  Date(GETDATE, 'YYYY-MM')   as [Year - Month],

  'Q' & Ceil(Month(GETDATE) / 3)   as [Quarter]

P.S. - change your date format in text file as YYYY/MM/DD.

Thanks

BKC

qlikviewwizard
Master II
Master II
Author

Hi balkumarchandel,

Thank you for the script.I loaded successfully.

As shown in pic, If I select Q2, SHould show Q1 and Q2 as well.

Could you send me expression?

Capture.PNG

er_mohit
Master II
Master II

Hi

Attached herewith sample data.

Hope it helps

Thanks

Mohit

ankitaag
Partner - Creator III
Partner - Creator III

Hi,

Refer the attached application.

Thanks

Anonymous
Not applicable

can you share your sample application as in text file date format is not correct.

qlikviewwizard
Master II
Master II
Author

Hi balkumarchandel,

Please find the attached file.

AnkitaAg‌, ER.Mohit‌: ! Thank you for the sample files. But it is not I am looking for.

Anonymous
Not applicable

Hi ,

you need to load a data island for selection column .

See attached qvw, Hope it will help you

qlikviewwizard
Master II
Master II
Author

Thank you balkumarchandel chandel

Anonymous
Not applicable

ur welcome