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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Lokesh_5045
Creator
Creator

Urgent requirement: show current and selected month values side by side

I am new to Qlik Sense. I have the data like below.

ID Month Value
A Dec 10
B Dec 20
C Dec 30
A Jul 100
B Jul 200
C Jul 300
D Jul 400

 

Now I need to show Jul values in separate column if Jul ID is matching with Dec ID.
Expected output shown below:

ID Month Value July month values for same id
A Dec 10 100
B Dec 20 200
C Dec 30 300

 

I cannot do any changes in Script editor. I have to do it on sheet (Front end).
I used this expression for 4th column.

Labels (4)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

As below

 

Capture.PNG

temp:
load 
ID
,Monthstart(date#(Month,'MMM-YY')) as Date
,MonthName(date#(Month,'MMM-YY')) as Month
,Value
inline [
ID,Month,Value
A,Dec-22,10
B,Dec-22,20
C,Dec-22,30
A,Jul-22,100
B,Jul-22,200
C,Jul-22,300
D,Jul-22,400
A,Sep-22,1000
B,Sep-22,2000
C,Sep-22,3000
D,Sep-22,4000
];


exit Script;

 

Chart

Dimensions

=ID

=Aggr({<Month=>}Only({<Date={"$(=Max({<Month=>}Date))"}>}Month),ID)

 

Measure

Current Month = Sum({<Date={"$(=Max({<Month=>}Date))"},Month=>}Value)

Selected Month = Sum({<Date={"$(=Max(Date))"}>}Value)

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

View solution in original post

4 Replies
deepanshuSh
Creator III
Creator III

If you dont intend to use the month field in the table, then it could be done easily, just use the if and else condition to create a set of expressions for each month. 

For example;

Aggr(if (match(ID, ID), Value), Month)

Trial and error is the key to get unexpected results.
Lokesh_5045
Creator
Creator
Author

@deepanshuSh , Thank you for your reply.
If there only two values in month field, it may work. But I have multiple months and I have stored a selected month as my variable input.

Suppose if I select Sept month, then 4th column should be Selected month values.

vinieme12
Champion III
Champion III

As below

 

Capture.PNG

temp:
load 
ID
,Monthstart(date#(Month,'MMM-YY')) as Date
,MonthName(date#(Month,'MMM-YY')) as Month
,Value
inline [
ID,Month,Value
A,Dec-22,10
B,Dec-22,20
C,Dec-22,30
A,Jul-22,100
B,Jul-22,200
C,Jul-22,300
D,Jul-22,400
A,Sep-22,1000
B,Sep-22,2000
C,Sep-22,3000
D,Sep-22,4000
];


exit Script;

 

Chart

Dimensions

=ID

=Aggr({<Month=>}Only({<Date={"$(=Max({<Month=>}Date))"}>}Month),ID)

 

Measure

Current Month = Sum({<Date={"$(=Max({<Month=>}Date))"},Month=>}Value)

Selected Month = Sum({<Date={"$(=Max(Date))"}>}Value)

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

@vinieme12 , Thank you so much