Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Set analysis

Hello

I have data like (attached):

   

TypeCategoryDateIDData
PlannedWork2015.01.0113
FactWork2015.01.0114
PlannedWork2015.01.0225
FactSick2015.01.0226

I need to get a pivot table in front end like:

   

IDSum of plannedSum of fact
134

The solution need to take only days where Planned and Fact categories are both Work.

Thank you in advance

1 Solution

Accepted Solutions
sunny_talwar

May be like attached

Updated:

Script

Table:

LOAD *,

  AutoNumber(Date&ID) as NewField;

LOAD * INLINE [

    Type, Category, Date, ID, Data

    Planned, Work, 2015.01.01, 1, 3

    Fact, Work, 2015.01.01, 1, 4

    Planned, Work, 2015.01.02, 2, 5

    Fact, Sick, 2015.01.02, 2, 6

];

Dimension

ID

Expressions

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Planned'}>}Data)

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Fact'}>}Data)

or

Dimension

ID

Type

Expression

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Planned', 'Fact'}>}Data)

Capture.PNG

View solution in original post

8 Replies
Anil_Babu_Samineni

May be this?

Expr1

If(Category=Category,Sum({<Type = {Planned}>}Data))

Expr2

If(Category=Category,Sum({<Type = {Fact}>}Data))

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
sibusiso90
Creator III
Creator III

Use the following expressions and use ID as your Dimension

sum({<Type={'P'},Category={'Work'}>}Data)

sum({<Type={'F'},Category={'Work'}>}Data)

kamal_sanguri
Specialist
Specialist

Create a Pivot chart with

Dimension

ID

Expression

Sum({<Type = {'Planned'}, Category = {'Work'}>}Data) -- > This would be Sum of Planned


Sum({<Type = {'Fact'}, Category = {'Work'}>}Data) -- > This would be Sum of Fact


vinieme12
Champion III
Champion III

try below

sum({<ID = e({<Category={'Sick'}>}ID)>}Data)


app attached

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

May be like attached

Updated:

Script

Table:

LOAD *,

  AutoNumber(Date&ID) as NewField;

LOAD * INLINE [

    Type, Category, Date, ID, Data

    Planned, Work, 2015.01.01, 1, 3

    Fact, Work, 2015.01.01, 1, 4

    Planned, Work, 2015.01.02, 2, 5

    Fact, Sick, 2015.01.02, 2, 6

];

Dimension

ID

Expressions

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Planned'}>}Data)

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Fact'}>}Data)

or

Dimension

ID

Type

Expression

=Sum({<NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}, Type = {'Planned', 'Fact'}>}Data)

Capture.PNG

kamal_sanguri
Specialist
Specialist

Hi stalwar1‌, I really liked the way you achieved it. But still need your help to understand it further.

The Firt Part of modifier - NewField = {"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}


How it will work,


This expression would return either -1 or 0 (True or False).

{"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"}

And, NewField would be any number but greater 0 (So can never be 0 or -1).

kamal_sanguri
Specialist
Specialist

Ohk.. I think it is working in a different way.. It is picking those records where for NewField  this condition

{"=Only({<Type = {'Planned', 'Fact'}>} Category) = 'Work'"} is true. Is this correct ?

sunny_talwar

Yup, you are right