Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bar Chart Help

My dimension for the bar chart is date field, there are almost 150 values(5 months) in it but I want to show only one month data(latest month).

Thanks.

9 Replies
sunilkumarqv
Specialist II
Specialist II

Expression: sum({<DateField={">=$(=Num(MonthStart(Max(Datefield))))"},Year=,Month=,DateField>}value)

Kushal_Chawda

use calculated dimension

=date(max(monthname(Date)),'MMM-YYYY')

sorrakis01
Specialist
Specialist

Hi,

Create a calculated dimension or use set analysis.

Calculated Dimension date(max(monthname(Date)),'MM-YYYY')

Regards,

Not applicable
Author

Thank you all for your quick response,

My bad I didn't put question in right way,

I am expecting latest month i.e., 30 bars in bar chart.

Kushal_Chawda

Try this

=sum({<DateField={">=$(=date(monthstart(max(monthname(Datefield))),'YourDateFieldFormat'))<=$(=date(monthend(max(monthname(Datefield))),'YourDateFieldFormat'))"},Year,Month,DateField>}value)

Kushal_Chawda

have you resolved ?

maxgro
MVP
MVP

last 30 days?

sum({$<year=,month=,date={">=$(=date(today()-30))<=$(=date(today()))"}>} value)

sunny_talwar

Like this?

Capture.PNG

Since 6/14/2015 is the max date in the database, you will see the bar chart starting from 5/15/2015 and goes up till 6/15 2015 (30 days)

Expression:

=Sum({<Date = {"$(= '>=' & Date(Max(Date)-30) & '<=' & Date(Max(Date)))"}>}Value)

I used just date here without specifying its format because I used Date() function in the script also which takes the same format that I specified at the beginning of my script:

SET DateFormat='M/D/YYYY';

Table:

LOAD Date(41639 + IterNo()) as Date,

  Ceil(Rand() * 100000) as Value

AutoGenerate 1

While IterNo() <= 530;

You may not be using Date function for you date. and if that's true than you would need to use the same format as you date in the set analysis function:

=Sum({<Date = {"$(= '>=' & Date(Max(Date)-30, 'yourDateFormat') & '<=' & Date(Max(Date), 'yourDateFormat'))"}>}Value)

I hope this would help you.

Best,

Sunny

qlikviewwizard
Master II
Master II

Hi

Please use calculated dimension like this. Hope this will help you.

=date(max(monthname(Date)),'MM-YYYY')