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

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mouni09
Contributor III
Contributor III

Dimension limitation for 16 weeks in Line chart

Hello All, 
I am creating line chart in which I have below as Dim and Measure

Dimension : "Week" which is in format as below

Mouni09_0-1750950304297.png

I want to limit only for dynamic last 16 weeks excluding present week which start from June22, data should show from week Mar.2 - Mar.8,2025 to Week Jun.15- Jun.22, 2025
I want to create through Limitations option only, don't want to create new column or master dimension

Measure:
Num(
Count(
{<[Type] = {'L'}>}
DISTINCT
Aggr(
If(
Min({<[Type] = {'EL'}>} Date) - Min({<[Type] = {'L'}>} Date) <= 7,
[L ID]
),
[L ID]
)
)
/ Count({<[Type] = {'L'}>} DISTINCT [L ID]),
'0.00%'
)

Please help

Labels (4)
8 Replies
aswk
Contributor II
Contributor II

Hi,

If you have a Date field, you can try setting your parameters using set analysis.
--> {<YourDateField = {">=$(=WeekStart(Today()) - 7*16)<$(=WeekStart(Today()))"}>}

Let me know if this works.

Mouni09
Contributor III
Contributor III
Author

Hi @aswk ,
Thanks for replying

I have tried like below in measure:
Num(
Count({
<[Type] = {'L'},
Date = {
">=$(=Date(WeekStart(Today()) - 7*16, 'MM/DD/YYYY'))<$(=Date(WeekStart(Today()), 'MM/DD/YYYY'))"
}>
} DISTINCT
Aggr(
If(
Min({<[Type] = {'EL'}>} Date) -
Min({<[Type] = {'L'}>} Date) <= 7,
[L ID]
),
[L ID]
)
)
/
Count({
<[Type] = {'L'},
Date = {
">=$(=Date(WeekStart(Today()) - 7*16, 'MM/DD/YYYY'))<$(=Date(WeekStart(Today()), 'MM/DD/YYYY'))"
}>} DISTINCT [L ID]),
'0.00%'
)

Dimension Given : Week ---(Week Formatted as Jun.15 - Jun.21, 2025)
But in chart week is coming as 3/15/2025 etc

Mouni09_0-1751005320232.png


Expecting week to show as Jun.15 - Jun.21, 2025

Please help

Thanks!

aswk
Contributor II
Contributor II

Qlik has trouble handling custom formats in graphs, so you might want to try forcing them.

Try this in the date dimension of your chart --> =Date(WeekStart(Date), 'MMM.DD') & ' - ' & Date(WeekEnd(Date), 'MMM.DD, YYYY')

Mouni09
Contributor III
Contributor III
Author

It worked,
Thanks!
I got other issue now
I have week filter pane, in which if I select any week it's showing different value for that selected week in Line chart, if I unselect and see result for all 16 weeks it's different
Ex: for whole 16 weeks full chart Mar.02-Mar.9, 2025 valuwe is 26.80%, but selected only that particular week from filter pane it's 20.52%
In filter I used 
=Dual(

If(
and WeekStart(Date) >= WeekStart(Today() - 7*16) // ≥ 16 weeks ago
and WeekStart(Date) < WeekStart(Today()), // < current week
Date(WeekStart(Date), 'MMM.DD') & ' - ' &
Date(WeekEnd(Date), 'MMM.DD, YYYY')
),

WeekStart(Date)
)

Measure as I have used above

aswk
Contributor II
Contributor II

This is because the context is different.
Here you might need to reuse the set analysis you applied earlier, inside the min functions within the Aggr().

-->
Num( 
start of your measure ...
Aggr(
If(
Min({<[Type] = {'EL'}, Date = {">=$(=Date(WeekStart(Today()) - 7*16))<$(=Date(WeekStart(Today())))"}>} Date)
-
Min({<[Type] = {'L'}, Date = {">=$(=Date(WeekStart(Today()) - 7*16))<$(=Date(WeekStart(Today())))"}>} Date)
<= 7,
[L ID]
),
[L ID]
)
end of your measure...
)

The measure should return the same results, even with filters applied.
Hope this helps 🙂

Mouni09
Contributor III
Contributor III
Author

Hey @aswk ,
Thanks for patiently replying
This issue is maybe beacuse my TRnaform script, for each event there is a Date column, Like for Event 'EL' there is EL date, for 'L' L Date, for 'PC' PC Date etc
and there is one key table built based on all these columns with only one column Date and all the events are mentioned in "Type" Column, I don't know why when I'm using direct columns like EL date or L date it's working fine and showing same number when something from filterpane is selected, but using Date column and filtering inset analysis with Type it's giving differnt output

EL_EVENT TABLE:LOAD
ID, EL DATE
FROM EL.qvd

L_EVENT TABLE : LOAD
ID, L DATE
FROM L.qvd;

KEY TABLE1: LOAD
ID, 'EL' as Type
EL DATE as DATE
RESIDENT EL_EVENT TABLE

CONCATENATE : LOAD
ID, 'L' as Type
L DATE as DATE
RESIDENT L_EVENT TABLE

DATE TABLE:
DATE, 
WEEK (new column),
Month, Year, qtr 
Resdent Key1 table

and in filterpane week from Date table is used and inside measure I'm using from Date giving Type filter instead using L DATE and EL DATE because using common SDATE column from date table is recommendable

aswk
Contributor II
Contributor II

No problem @Mouni09 
The issue is probably coming from your table with Date and Type.
Do you have duplicate dates for different types?

Mouni09
Contributor III
Contributor III
Author

no itseems