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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
kiansin
Contributor
Contributor

Make a bar chart just showing only for this current year

 

9f1eb169-6e24-4bad-b42f-0662c794de43.jpgG

 Good day !
I have one chart which is "Sales overview by Period" , and I want it to show the current year , which is from 202301 - 202312. But there is one "open" (yellow color) postpone to "202510" , but I only want this chart to show from 202301 - 202312, do you have any script advise to remove 202510 ?

 

 

458fdcdc-b4d4-4819-b312-310e5432c044.jpg

 this is my current script for "Open" as above.

Kindly help for this. 

Thanks in advance !!

Labels (2)
2 Replies
vinieme12
Champion III
Champion III

add below criteria to your existing expression

 

Datefield={">=$(=Date(YearStart( today() ),'YYYY-MM-DD'))<=$(=Date(YearEnd( today() ),'YYYY-MM-DD'))"}

 

replace Datefield  with the actual datefield name in your datamodel

replace YYYY-MM-DD  with the date format as in your date field

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
barnabyd
Partner - Creator III
Partner - Creator III

G'day @kiansin, I have a different method to achieve this type of outcome.

I create a flag in the load script on each row of data, something like this:

Sales:
load SaleDate
   , if( year( SaleDate ) = 2023, 1, 0 ) as CurYear
   , Amount
resident SaleTable;

Then in the chart, I would have an expression like this:

sum( {$<CurYear = {1}>} Amount )

I hope this helps.

Cheers, Barnaby.

Barnaby Dunn
BI Consultant