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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
SyedMuhammadTaha
Contributor
Contributor

Line chart not showing data for second If() condition in Pick() expression

I’m working on a Qlik Sense line chart where I use a nested Pick() and If() expression to display different utilization metrics depending on a dimension value. The idea is to calculate a utilization ratio for several categories (e.g., Final Utilization, Forecast, X Week Out), while also applying different forecast “lift” adjustments for future weeks


Here is my expression:

Num(
Pick(
Match(
[MetricName],
'Final Utilization',
'Forecast',
'X Weeks Out'
),

//  Final Utilization
Alt(
Sum({<[WeeksAhead]={'-2'}>} [ActualValue]) / Sum({<[WeeksAhead]={'-2'}>} [Capacity]),
Sum({<[WeeksAhead]={'0'}>} [ActualValue]) / Sum({<[WeeksAhead]={'0'}>} [Capacity])
),

// Forecast with lift
If(
Floor([WeekNum]) >= $(vCurrentWeek) and Floor([WeekNum]) <= $(vCurrentWeek) + 5,
Pick(
1 + (Floor([WeekNum]) - $(vCurrentWeek)),
Alt(
Sum({<[WeeksAhead]={'-2'}>} [ActualValue]) / Sum({<[WeeksAhead]={'-2'}>} [Capacity]),
Sum({<[WeeksAhead]={'0'}>} [ActualValue]) / Sum({<[WeeksAhead]={'0'}>} [Capacity])
),
Sum({<[WeeksAhead]={'1'}>} [ActualValue]) / Sum({<[WeeksAhead]={'1'}>} [Capacity]) + $(vLift_10),
Sum({<[WeeksAhead]={'2'}>} [ActualValue]) / Sum({<[WeeksAhead]={'2'}>} [Capacity]) + $(vLift_20),
Sum({<[WeeksAhead]={'3'}>} [ActualValue]) / Sum({<[WeeksAhead]={'3'}>} [Capacity]) + $(vLift_30),
Sum({<[WeeksAhead]={'4'}>} [ActualValue]) / Sum({<[WeeksAhead]={'4'}>} [Capacity]) + $(vLift_40),
Sum({<[WeeksAhead]={'5'}>} [ActualValue]) / Sum({<[WeeksAhead]={'5'}>} [Capacity]) + $(vLift_50)
),
Null()
),

// X Weeks out
If(
Floor([WeekNum]) >= $(vCurrentWeek) and Floor([WeekNum]) <= $(vCurrentWeek) + 5,
Pick(
1 + (Floor([WeekNum]) - $(vCurrentWeek)),
Alt(
Sum({<[WeeksAhead]={'-2'}>} [ActualValue]) / Sum({<[WeeksAhead]={'-2'}>} [Capacity]),
Sum({<[WeeksAhead]={'0'}>} [ActualValue]) / Sum({<[WeeksAhead]={'0'}>} [Capacity])
),
Sum({<[WeeksAhead]={'1'}>} [ActualValue]) / Sum({<[WeeksAhead]={'1'}>} [Capacity]),
Sum({<[WeeksAhead]={'2'}>} [ActualValue]) / Sum({<[WeeksAhead]={'2'}>} [Capacity]),
Sum({<[WeeksAhead]={'3'}>} [ActualValue]) / Sum({<[WeeksAhead]={'3'}>} [Capacity]),
Sum({<[WeeksAhead]={'4'}>} [ActualValue]) / Sum({<[WeeksAhead]={'4'}>} [Capacity]),
Sum({<[WeeksAhead]={'5'}>} [ActualValue]) / Sum({<[WeeksAhead]={'5'}>} [Capacity])
),
Null()
)
),
'##0%'
)

The first and second sections (Final Utilization & Forecast with lift) work as expected.
The third section (X Weeks Out) doesn’t display any line at all — even though the data exists

I have tried to make a measure for each section and add it separately to the chart, and line chart exactly show how I plan it to show. 

What I’d like help with

  • Why the second If() condition (X Weeks Out) doesn’t show any line.

Labels (5)
1 Reply
anat
Master
Master

are you getting any values for the "X Weeks out" expression?

create table and paste the "X Weeks out" logic then see r u getting any value or not?