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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
divya_j
Contributor
Contributor

Week on Week Comparison by Row

Hi,

Could you please help me to create week on week conditional highlight by selecting particular week.

For example if I select Week 04-11-2024, It should highlight any increase or decrease from previous week which is 28-10-2024 for each row.

Weekly Price for ProcuctsWeekly Price for Procucts

 

Thanks,

D

 

 

Labels (1)
5 Replies
Qrishna
Master
Master


I see you are using Pivot table.Try below:

Dims: Category, Weekstart

Measures:
Measure1: cw_sales = sum({$<Weekstart=>}Sales)

Measure1 text Color:
=if(GetSelectedCount(Weekstart)>0 and Weekstart = only(Weekstart) and (sum({$<Weekstart=>}Sales)-after(sum({$<Weekstart=>}Sales)))>0
, green()
, if(GetSelectedCount(Weekstart)>0 and Weekstart = only(Weekstart) and (sum({$<Weekstart=>}Sales)-after(sum({$<Weekstart=>}Sales)))<0, red()))

Measure2: pw_sales = after(sum({$<Weekstart=>}Sales

//use if needed
Measure3: diff = sum({$<Weekstart=>}Sales) - after(sum({$<Weekstart=>}Sales))
//= cw_sales - pw_sales

 

2492291 - Week on Week Comparison by Row (1).PNG

2492291 - Week on Week Comparison by Row (2).PNG

if Measure2 is not needed:

2492291 - Week on Week Comparison by Row (3).PNG

divya_j
Contributor
Contributor
Author

Thank you so much Qrishna.

Measure cw_sales and pw_sales worked.

However, i didn't get the answer using below measure. It's not displaying any color changes.

=if(GetSelectedCount(Weekstart)>0 and Weekstart = only(Weekstart) and (sum({$<Weekstart=>}Sales)-after(sum({$<Weekstart=>}Sales)))>0
, green()
, if(GetSelectedCount(Weekstart)>0 and Weekstart = only(Weekstart) and (sum({$<Weekstart=>}Sales)-after(sum({$<Weekstart=>}Sales)))<0, red()))

Aslo, if I select weekstart in filter, it only shows data for that week and previous weeks data is not shown and no 

divya_j_1-1731495087320.png

Nothing like your data shown in below image

divya_j_2-1731495167350.png

 

 

divya_j
Contributor
Contributor
Author

Also, I checked some of the previous number's are not displayed in current week

divya_j_4-1731495871969.png

 

 

divya_j
Contributor
Contributor
Author

Hi Qrishna,

I tried to swap the dimensions, Week start in rows and Category in Columns. I tried above logic, however it's not working. Same comparison of week by week is not working. Is their a way around. can you please suggest.

divya_j_0-1732182432584.png

Thanks,

Qrishna
Master
Master

Hi  @divya_j - not sure what expressions and dims you are using. i cannot really say anything about your situation just by looking at picture. i would suggest you create a mocked up data with 5-10 rows (or more would be better) of data in an excel and attach it over here, if not excel, just paste the mocked up data and expressions, so i know what you are trying to achieve with the expressions on the given data.