Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Zaga_69
Creator
Creator

Barchart

Hi guys,

I would like to build a barchart by year, but for the current year I just need the current month: For example:

When the end-user selecting a year and month in the dashboard the barchart should ignore the year and month selected for the previous years, however it should show the measure for the current month a and current year.

HEN barchart.JPG

The measure I created to ignore the selections in the dashboard:

SUM({<Year, Period>}SALES)

 

any idea?

 

Many thanks

Labels (1)
5 Replies
Vegar
MVP
MVP

I see two approaches
1. Create a new field that is mixing the value of current month with previous years. Use that field as a dimension for you chart. Maybe an "As of calendar"
2. Create multiple expressions in you chart and use hide conditions to hide the years that you don't want to see.
Zaga_69
Creator
Creator
Author

Hi Vegar,

I created two measures:

CURRENT PERIOD

sum({< Year_Month={"$(=max(Year_Month))"}>}Sales_New_Products)

PREVIOUS YEARS

sum({< Year={"<=$(=max(Year))"}>}Sales_New_Products)

When selecting the current year (2019) and any period it works well,however when selecting a lower period than the current year, of course all the years won'be shown.

The chart below contains two measures and in the Presentation option I selected the Stacked bar option.

Any idea how it could work? Your help will be appreciated.

HEN barchart v2.JPG

Vegar
MVP
MVP

Won't you get in trouble with
PREVIOUS YEARS

sum({< Year={"<=$(=max(Year))"}>}Sales_New_Products)

It includes the max year, should it not be
PREVIOUS YEARS

sum({< Year={"<$(=max(Year))"}>}Sales_New_Products)
Zaga_69
Creator
Creator
Author

It was a misspelling from my side. 

However, still I have the issue that the bar chart will react to the Year and Period selected by the user in the dashboard

Vegar
MVP
MVP

Ny period you mean the field Year_Month? The selection of that field will impact your years so you need to cancel it in the Set.

sum({< Year_Month, Year={"<$(=max(Year))"}>}Sales_New_Products)