Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Why the second If() condition (X Weeks Out) doesn’t show any line.
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?