Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
dana
Creator II
Creator II

MTD/PMTD bar chart

Hi,

I created a bar chart which displays current year and previous year  MTD.

I need to show the difference between the 2 values. Couldn’t figure out a way add this to the chart, so I added it to the title.

Anyone has an idea?

The dimension is Year

The bar expression:

Sum({<[Calendar.Year] ={">=$(vPrevYear)<=$(vMaxYear_1)"},[Calendar.MonthNum] = {'$(vMaxMonth_1)'}, [Calendar.Day] = {"<=$(vMaxDay_1)"}>}Customers_Count)

The difference expression:

($(v_CustCount_MTD_Dashboard)

/

$(v_CustCount_PMTD_Dashboard) )

-1,'#,##0%')

Thanks!

MTD_BAR_CHART.png

Labels (2)
1 Solution

Accepted Solutions
treysmithdev
Partner Ambassador
Partner Ambassador

Set Analysis happens before the data gets calculated over the dimensions. You can't do value of Dimension A vs Dimension B, while the Dimension is in the chart, unless you use inter-record functions, like Above() or change the model.

Here is how you can do it using Above().

Sum({<[Calendar.Year] ={">=$(vPrevYear)<=$(vMaxYear_1)"},[Calendar.MonthNum] = {'$(vMaxMonth_1)'}, [Calendar.Day] = {"<=$(vMaxDay_1)"}>}Customers_Count)

/ 

Above(Sum({<[Calendar.Year] ={">=$(vPrevYear)<=$(vMaxYear_1)"},[Calendar.MonthNum] = {'$(vMaxMonth_1)'}, [Calendar.Day] = {"<=$(vMaxDay_1)"}>}Customers_Count))

 

You should probably include year 2018 as well, so 2019 has a comparison value. If you uncheck 'Include zero Values' in the Add-Ons section, it will hide 2018 from the chart and only show 2019 & 2020, which the comparison %.

Blog: WhereClause   Twitter: @treysmithdev

View solution in original post

2 Replies
treysmithdev
Partner Ambassador
Partner Ambassador

Set Analysis happens before the data gets calculated over the dimensions. You can't do value of Dimension A vs Dimension B, while the Dimension is in the chart, unless you use inter-record functions, like Above() or change the model.

Here is how you can do it using Above().

Sum({<[Calendar.Year] ={">=$(vPrevYear)<=$(vMaxYear_1)"},[Calendar.MonthNum] = {'$(vMaxMonth_1)'}, [Calendar.Day] = {"<=$(vMaxDay_1)"}>}Customers_Count)

/ 

Above(Sum({<[Calendar.Year] ={">=$(vPrevYear)<=$(vMaxYear_1)"},[Calendar.MonthNum] = {'$(vMaxMonth_1)'}, [Calendar.Day] = {"<=$(vMaxDay_1)"}>}Customers_Count))

 

You should probably include year 2018 as well, so 2019 has a comparison value. If you uncheck 'Include zero Values' in the Add-Ons section, it will hide 2018 from the chart and only show 2019 & 2020, which the comparison %.

Blog: WhereClause   Twitter: @treysmithdev
dana
Creator II
Creator II
Author

It works!  Thank you very much!

No need to add 2018.

The only issue is the visibility:  the point hides the bar's value and I the value of the point is not displayed..

 

MTD_BAR_CHART1.png