Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Purushothaman
Partner - Creator III
Partner - Creator III

Past Week, Current Week and Future Week Color Highlight

Hi There,

This is my Requirement  on Past , current and future week Bar Chart Color Highlight

Past week Measure :

Profit should be in Blue

 Sales Should be in Red

Current Week Measure

Profit should be in Green

Sales Should be in Pink

Future Week Measure:

Profit should be in Yellow

Sales Should be in Orange

Purushothaman_0-1649664251924.png

Attached is my QVF.

Anyone, Please help.

Labels (4)
1 Solution

Accepted Solutions
Andrei_Cusnir
Specialist
Specialist

Hello,

 

My hypothesis is that the exact use case scenario can't be achieved natively, however there are some things that you can try. I will share with you 3 solutions, where the one is as close to yours as possible. You can get the idea behind the suggestions and hopefully it will help you proceed further. 

 

Why this is not possible:

 

Possible solution 1:

In Bar chart you specify the Color by Measure and you have 1 If statement that checks if the WeekNo is past, current or next and then you apply the colors by measure.

 

HOWEVER:

It is not possible to specify the measure for the color to be applied and thus it will be applied on both bars.

 

Possible solution 2:

You define different Master item Measures for Profit and Sales and for Past, Current, Future, where you apply the color that you want. After that in the measures you check if the WeekNo is Past, Current or Future, and you use the Master item that you want

 

HOWEVER:

If you use one of the Master item Measures then the colors that you have specified in the configuration are kept. But if you use the Master item Measures in If statement the colors are not kept.

 

Here are the only solutions that worked for me, even though partially:

Solution 1:  

Create 6 Master items:

  • ProfitPastWeek
  • SalesPastWeek
  • ProfitCurrentWeek
  • SalesCurrentWeek
  • ProfitFutureWeek
  • SalesfutureWeek

Use the expression to display the value only if condition is met e.g. If(WeekNo < Week(Today()), Sum(Profit)) etc. Additionally apply the correct values for each Master item Measure. The outcome is:

 

The only issue is the "Null" data for the rest of "Measures" where the condition is not met.

 

Solution 2:

Just use the Dimension reference lines under Add-ons, where you can specify 2 lines for the current week. This will add 2 lines that will mark the current week and it will be very clear as to which weeks are Past and which weeks are future:

 

Solution 3:

Create the Master item Measures as in Solution 1 but this time, create 3 individual  Bar charts:

This will allow you to display the proper colors in Bar chart 1 for past weeks, the proper colors in  Bar chart 2 for current week and the proper colors in Bar chart 3 for the future weeks

 

All the solutions are included in the updated version of your app that is attached to this post!

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

 


 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂

View solution in original post

2 Replies
Andrei_Cusnir
Specialist
Specialist

Hello,

 

My hypothesis is that the exact use case scenario can't be achieved natively, however there are some things that you can try. I will share with you 3 solutions, where the one is as close to yours as possible. You can get the idea behind the suggestions and hopefully it will help you proceed further. 

 

Why this is not possible:

 

Possible solution 1:

In Bar chart you specify the Color by Measure and you have 1 If statement that checks if the WeekNo is past, current or next and then you apply the colors by measure.

 

HOWEVER:

It is not possible to specify the measure for the color to be applied and thus it will be applied on both bars.

 

Possible solution 2:

You define different Master item Measures for Profit and Sales and for Past, Current, Future, where you apply the color that you want. After that in the measures you check if the WeekNo is Past, Current or Future, and you use the Master item that you want

 

HOWEVER:

If you use one of the Master item Measures then the colors that you have specified in the configuration are kept. But if you use the Master item Measures in If statement the colors are not kept.

 

Here are the only solutions that worked for me, even though partially:

Solution 1:  

Create 6 Master items:

  • ProfitPastWeek
  • SalesPastWeek
  • ProfitCurrentWeek
  • SalesCurrentWeek
  • ProfitFutureWeek
  • SalesfutureWeek

Use the expression to display the value only if condition is met e.g. If(WeekNo < Week(Today()), Sum(Profit)) etc. Additionally apply the correct values for each Master item Measure. The outcome is:

 

The only issue is the "Null" data for the rest of "Measures" where the condition is not met.

 

Solution 2:

Just use the Dimension reference lines under Add-ons, where you can specify 2 lines for the current week. This will add 2 lines that will mark the current week and it will be very clear as to which weeks are Past and which weeks are future:

 

Solution 3:

Create the Master item Measures as in Solution 1 but this time, create 3 individual  Bar charts:

This will allow you to display the proper colors in Bar chart 1 for past weeks, the proper colors in  Bar chart 2 for current week and the proper colors in Bar chart 3 for the future weeks

 

All the solutions are included in the updated version of your app that is attached to this post!

 

I hope that this information was helpful. In case I have misunderstood the use case scenario, please elaborate in details by providing additional information. However, if it has helped you resolve the issue, please mark it as accepted solution to give further visibility to other community members. 

 


 

 

Help users find answers! Don't forget to mark a solution that worked for you! 🙂
Purushothaman
Partner - Creator III
Partner - Creator III
Author

Thanks a lot @Andrei_Cusnir   for your great help!!! Much Appreciated.