Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ahammadshafi
Creator
Creator

Dynamic columns based on calculation

Dear Experts:

Here is the requirement from my client.

They want to update a report monthly where the columns of a table will be generated and named dynamically based on a calculation.

For example, in the sales table they will have the following columns

Sample Data.PNG

The report will show the following

Requirement.PNG

In the report

  1. The first column will show the products which has some changes in sales against "Sales Today".

  2. Only those months will be shown where there is changes in sales

               Here, for Product "A" there is change (1 unit) against 3rd previous month.

                         for Product "B" there are changes in sales against 1st and 3rd month.

                         for Product "C" there are changes in sales against 1st and 3rd month.

               But there is no changes in sales against 2nd month - as a result the report didn't show anything like "Change against 2nd                month"

Seeking your opinions to achieve this requirement.

Sample data is attached.

Shafi

1 Solution

Accepted Solutions
12 Replies
Anonymous
Not applicable

Hi Ahammad,

Apply following expression:

Dimension :- Product

Expression1:Change against 1st month:- [Sales last month]-[Sales Today]

Expression2:Change against 3rd month:- [Sales Today]-[Sales 3 months back]

From above you will get following reselt

ProductChange against 1st monthChange against 3rd month
A01
B23
C-15


Thanks,

Anonymous
Not applicable

Hey I am correcting my above expressions:

Dimension :- Product

Expression1:Change against 1st month:- [Sales Today]-[Sales last month]

Expression2:Change against 3rd month:- [Sales Today]-[Sales 3 months back]

From above you will get following result

ProductChange against 1st monthChange against 3rd month
A01
B-23
C15

Thanks,

Anil_Babu_Samineni

Till Report, i am happy. After that, i am not sure i understand your rek. Would you share the epected result to show

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
varshavig12
Specialist
Specialist

conditional Hide/Show

varshavig12
Specialist
Specialist

Chart Straight table,

Dim - Product, today Sales

Expression - 1.     [Sales last month]-[Sales Today]

                    2.     [Sales 2 months back]-[Sales Today]

                    3.     [Sales 3 months back]-[Sales Today]

PRESENTATION -

     Conditional show/hide --- for exp 2:      if(sum(total([Sales 2 months back]-[Sales Today]))=0,0,1)

and so on for others

varshavig12
Specialist
Specialist

Oh! It is current - last month

So just make the change in the formula:

Like:

[Sales Today]-[Sales last month]

[Sales Today]-[Sales 2 months back]

[Sales Today]-[Sales 3 months back]

PRESENTATION -

     Conditional show/hide --- for exp 2:      if(sum(total([Sales Today]-[Sales 2 months back]))=0,0,1)

and so on for others

I hope this helps!

ahammadshafi
Creator
Creator
Author

Hi All:

Many thanks for your replies.

Sorry that I missed one point - it is not fixed that client will want to show the difference only for 3 months. The number of months could vary; like it can be 4 months or 5 months or 2 months. It will depend on the input data they will provide.

Hi Anil:

Please let me rephrase the requirement in words.

In input data the the client will share today's sales and sales of few previous months (the number of months can vary - like it can have 1 month or 2 months or 3 months.... or 9 months).

In the report we have to show the difference in sales with previous months. No columns will be shown if there is no difference with a month.

In the given example there are sales of previous 3 months, but tomorrow they can share input data with only 2 previous months. So, tomorrow the number of columns in the table should decrease.

Please let me know if that helps.

Shafi

ahammadshafi
Creator
Creator
Author

Hi Varsha:

Many thanks.

Sorry that I missed one requirement. The number of expression will vary based on the number of months given in input data. In next refresh the client may give 4 previous months data or 5.

Shafi

varshavig12
Specialist
Specialist

ahh!

Okay, no problem.

Can you please tell me how you get this data from your client ?

Just like in excel i.e this month, last month , last 2 month

or in proper months like 112016, 102016 etc.