7 Replies Latest reply: Sep 20, 2017 5:58 AM by Jaime Soriano Ochoa

# Restrict Dimension Value

Hi All,

I have dimension values as Q3-2017, Q2-2017, Q1-2017 and so on. I want to restrict the dimension only to the current quarter which is Q3-2017.

• ###### Re: Restrict Dimension Value

Hi,

Try like below

example, using set analysis expression,

let say you have Sales.

sum( {<quarter -={'Q3-2017'}>} Sales)

Thanks, Deva

• ###### Re: Restrict Dimension Value

I always want current quarter to be displayed. This is just restricting it to 'Q3-2017'

Thanks,

Monu

• ###### Re: Restrict Dimension Value

use the below SET modifier in your chart expressions:

{< Quarter = {'Q3-2017'} >}

• ###### Re: Restrict Dimension Value

Try this,

Sum({\$<Date={">=\$(=QuarterStart(Max(Date)))<=\$(=QuarterEnd(Max(Date)))"}>}Sales)

Regards,

Pratik

• ###### Re: Restrict Dimension Value

Ok. let me be more clear.

I have a filter pane where quarter values are populated.Ex- Q3-2017, Q2-2017 and so on

In that filter pane i am expecting only latest Quarter Value.

Thanks

• ###### Re: Restrict Dimension Value

maybe this:

Only( {< Quarter = {"=Max(Quarter)"} >} Quarter )

as a calculated dimension.

• ###### Re: Restrict Dimension Value

Hello Monu,

Are you talking about restricting from the first day of the current quarter (in this case 07/01/17) until today? In that case you should check everything related to Quarter to Date (QTD) staff.

YTQ, QTD, MTD and WTD

Create calendar measures ‒ Qlik Sense Cloud

An autoCalendar may help you, this is the script I have in my app:

DECLARE FIELD DEFINITION Tagged ('\$date')

FIELDS

Dual(Year(\$1), YearStart(\$1)) AS [Year] Tagged ('\$axis', '\$year'),

Dual('Q'&Num(Ceil(Num(Month(\$1))/3)),Num(Ceil(NUM(Month(\$1))/3),00)) AS [Quarter] Tagged ('\$quarter', '\$cyclic'),

Dual(Year(\$1)&'-Q'&Num(Ceil(Num(Month(\$1))/3)),QuarterStart(\$1)) AS [YearQuarter] Tagged ('\$yearquarter', '\$qualified'),

Dual('Q'&Num(Ceil(Num(Month(\$1))/3)),QuarterStart(\$1)) AS [_YearQuarter] Tagged ('\$yearquarter', '\$hidden', '\$simplified'),

Month(\$1) AS [Month] Tagged ('\$month', '\$cyclic'),

Dual(Year(\$1)&'-'&Month(\$1), monthstart(\$1)) AS [YearMonth] Tagged ('\$axis', '\$yearmonth', '\$qualified'),

Dual(Month(\$1), monthstart(\$1)) AS [_YearMonth] Tagged ('\$axis', '\$yearmonth', '\$simplified', '\$hidden'),

Dual('W'&Num(Week(\$1),00), Num(Week(\$1),00)) AS [Week] Tagged ('\$weeknumber', '\$cyclic'),

Date(Floor(\$1)) AS [Date] Tagged ('\$axis', '\$date', '\$qualified'),

Date(Floor(\$1), 'D') AS [_Date] Tagged ('\$axis', '\$date', '\$hidden', '\$simplified'),

If (DayNumberOfYear(\$1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,

Year(Today())-Year(\$1) AS [YearsAgo] ,

If (DayNumberOfQuarter(\$1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,

4*Year(Today())+Ceil(Month(Today())/3)-4*Year(\$1)-Ceil(Month(\$1)/3) AS [QuartersAgo] ,

Ceil(Month(Today())/3)-Ceil(Month(\$1)/3) AS [QuarterRelNo] ,

If(Day(\$1)<=Day(Today()),1,0) AS [InMTD] ,

12*Year(Today())+Month(Today())-12*Year(\$1)-Month(\$1) AS [MonthsAgo] ,

Month(Today())-Month(\$1) AS [MonthRelNo] ,

If(WeekDay(\$1)<=WeekDay(Today()),1,0) AS [InWTD] ,

(WeekStart(Today())-WeekStart(\$1))/7 AS [WeeksAgo] ,

Week(Today())-Week(\$1) AS [WeekRelNo] ,

DERIVE FIELDS FROM FIELDS [FECHA] USING [autoCalendar] ;

(change "FECHA" for the name of your date field.