Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Naushad07
New Contributor II

How do I restrict data till current month in Bar chart?

Hi All,

I have a requirement where I have to display the bar chart till only the current month. Need help on how to achieve this functionality?.

Details:

I have Data from 2016 till 2020. But I want to restrict my bar chart to display till current month. 

1 Solution

Accepted Solutions

Re: How do I restrict data till current month in Bar chart?

Hi,

you should use the set analysis for that.

Below is the example.

 

Sum({<Date = {"<=$(=Monthend(today()))"}>}Sales)

 

For more information on Set analysis, find below link.

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/ChartFunctio...

 

Regards,

Kaushik Solanki

7 Replies

Re: How do I restrict data till current month in Bar chart?

My preference would be, create Month field with integer and use formula like

Sum({<MonthNum = {"$('<=' & =Max(MonthNum))"}, Year={"$('<=' & =Max(Year))"}>} Sales)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Re: How do I restrict data till current month in Bar chart?

Hi,

you should use the set analysis for that.

Below is the example.

 

Sum({<Date = {"<=$(=Monthend(today()))"}>}Sales)

 

For more information on Set analysis, find below link.

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/ChartFunctio...

 

Regards,

Kaushik Solanki

Shubham_Deshmukh
Valued Contributor

Re: How do I restrict data till current month in Bar chart?

Hi @Naushad07 ,

You can restrict it using calculated dimension, edit your dimension like below (keep date format as per yours) : 

=if(date(yourDateField,'dd/mm/yyyy')<date(MonthEnd(today()),'dd/mm/yyyy'),yourDateField)

OR use exp like this

=Sum({<yourDateField= {"<=$(=MonthEnd(today()))"}>}yourQuantity)

 
Naushad07
New Contributor II

Re: How do I restrict data till current month in Bar chart?

My current Expression is 

Count({<SetAnalysis={'Condition1'}>}Distinct Projects)

I am taking Month in X axis..

I have tried the expression that you have suggested..looks like it doesn't work

Partner
Partner

Use SET analysis to restrict data till current month in Bar chart?

Lets assume that your current expression is SUM(Amount) and that you got an
numeric YearMonth field that increase numerically by every month. E.g.
201901, 201902 OR created by monthName() function. Then you can do the
following.


Adjust your expression with set analysis.

Sum( {< YearMonth={"$(=max(YearMonth))"} >} Amount)

This expressive will calculate the amount for the latest yearmonth in your
selection/data.

#OnVacation #BetweenJobs.
Please ekskuse my Norglish and Swenglish typos.
Naushad07
New Contributor II

Re: How do I restrict data till current month in Bar chart?

I am using Month in X axis, Not Date. I am displaying Bar chart month over month

Re: How do I restrict data till current month in Bar chart?

It doesnt matter, your X axis could be month, but the Date filter used in set analysis, will filter month by default.

Try the given expression and you will see the difference.

 

Regards,

Kaushik Solanki