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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
xyz20
Contributor II
Contributor II

Show Last Period in a visual

I want to show  value of Last period last period in a bar chart which will contain all periods in a year selected. when i am applying this expression Sum(
{<
[QP_PARENT4] = {'abc'},
PERIOD_YEAR_GB = {"$(=Max(PERIOD_YEAR_GB))"},
PERIOD_NUM = {"$(=Max({<PERIOD_YEAR_GB={"$(=Max(PERIOD_YEAR_GB))"}>} PERIOD_NUM)-1)"},
ENTERED_PERIOD_NAME =
>}
CLOSING_BALANCE
)

It is only showing me one bar of one month . while i want all months in one plot.

 

7 Replies
sbaro_bd
Creator III
Creator III

Hi @xyz20 ,

Can you provide an example application with data? Thanks.

Regards.

Qrishna
Master
Master

sample data and expected output ?

evabee
Contributor
Contributor

How to show previous period table when filtering current period?

I want to show in a table visual the data of current period and previous period when i filter current period. Then compute their percentage of change.

sbaro_bd
Creator III
Creator III

Try with the addyears function in your expression to show the values associated to the previous year. For example, like this :  PERIOD_YEAR_GB = {"$(=AddYears(PERIOD_YEAR_GB,-1))"}, with PERIOD_YEAR_GB like your year field.

Qrishna
Master
Master

lets say you have data:
data:
load * inline [
YearMonth,Value
2024-Jan, 10
2024-Feb,20
2024-Mar,20
2024-Apr,40
2024-May,20
2024-Jun,25
2024-Jul,15
2024-Aug,60
2024-Sep,50
];


UI: st table:
Dim:YearMonth
Measure1: CurrMonth =sum(Value)
Measure2: PrevMonth = if(isnull(Above(Sum(Value))), 0, Above(Sum(Value)))
Measure3: % =Num((PrevMonth-CurrMonth)/PrevMonth, '##.##%')

Qrishna
Master
Master

something like this?

2491777 - Create status using two different fields (1).PNG

BrendaKerrigan
Contributor
Contributor

Your set analysis is filtering the entire chart to one period (Max year + Max period − 1), so you only get a single bar; to show all months while displaying the previous period’s value per bar, use a row-wise function instead of set analysis, e.g. sort the chart by PERIOD_NUM ascending and use: =RangeSum( Above( Sum({<[QP_PARENT4]={'abc'}, PERIOD_YEAR_GB={'$(=Max(PERIOD_YEAR_GB))'}>} CLOSING_BALANCE), 1, 1 ) ) — this returns the value from the prior period for each month while keeping every month visible; if you instead want a flat reference line of the last period’s value across all bars, add a second measure like =Only( Total Sum({<[QP_PARENT4]={'abc'}, PERIOD_YEAR_GB={'$(=Max(PERIOD_YEAR_GB))'}, PERIOD_NUM={'$(=Max(PERIOD_NUM))'}>} CLOSING_BALANCE) )

EpyTV