Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
alan_grn
Creator II
Creator II

Displaying a time series with a date selected

I have a chart with Business Date as the Dimension and Sum([Balance]) as the Expression.

When I selcted a business date I would like to display in the chart all days up to and including the Business Date selcted or the previous x number of days.

1 Solution

Accepted Solutions
Not applicable

Hi,

When you want to calculate previous day, try this formula:

SUM({$<[Business Date]={$(='"='&DATE(MAX([Business Date]-1))&'"')}>} [Cr Balance])

And if you want to calculate previous 5 days:

SUM({$<[Business Date]={$(='">='&DATE(MAX([Business Date]-5))&'<='&DATE(MAX([Business Date]))&'"')}>} [Cr Balance])

Milda

View solution in original post

9 Replies
Not applicable

Hi,

if you want so see all dates until the selected one, you can use Set analysis in expression:

SUM({$<[Business Date]={$(='"<='&DATE(MAX([Business Date]))&'"')}>} [Balance])

Milda

alan_grn
Creator II
Creator II
Author

Thanks that is great. I am also trying to bring back the balance for the previous day.

I have the following formula, but it keeps returning the value of the date slected.

SUM({$<[Business Date]={$(='"='&DATE(([Business Date]-1))&'"')}>} [Cr Balance])



alan_grn
Creator II
Creator II
Author

How would I do this if I wanted it between two dates. i.e. Business dates and the previous 5 days?

Not applicable

Hi,

When you want to calculate previous day, try this formula:

SUM({$<[Business Date]={$(='"='&DATE(MAX([Business Date]-1))&'"')}>} [Cr Balance])

And if you want to calculate previous 5 days:

SUM({$<[Business Date]={$(='">='&DATE(MAX([Business Date]-5))&'<='&DATE(MAX([Business Date]))&'"')}>} [Cr Balance])

Milda

alan_grn
Creator II
Creator II
Author

Thanks Milda. That is great. I managed to figure out the previous days calculation myself, but the code for the range is great. I am reasonably new to Qlickview and wonder if I use variables if this will run any quicker.

For example I can have a variable call vPrevious day which will be DATE(MAX([Business Date]-1))

Would this make the calculations any quicker?

Thanks for all your help.

alan_grn
Creator II
Creator II
Author

Thanks Milda. That is great. I managed to figure out the previous days calculation myself, but the code for the range is great. I am reasonably new to Qlickview and wonder if I use variables if this will run any quicker.

For example I can have a variable call vPrevious day which will be DATE(MAX([Business Date]-1))

Would this make the calculations any quicker?

Thanks for all your help.

alan_grn
Creator II
Creator II
Author

Thanks Milda. That is great. I managed to figure out the previous days calculation myself, but the code for the range is great. I am reasonably new to Qlickview and wonder if I use variables if this will run any quicker.

For example I can have a variable call vPrevious day which will be DATE(MAX([Business Date]-1))

Would this make the calculations any quicker?

Thanks for all your help.

alan_grn
Creator II
Creator II
Author

Thanks Milda. That is great. I managed to figure out the previous days calculation myself, but the code for the range is great. I am reasonably new to Qlickview and wonder if I use variables if this will run any quicker.

For example I can have a variable call vPrevious day which will be DATE(MAX([Business Date]-1))

Would this make the calculations any quicker?

Thanks for all your help.

Not applicable

Hi,

you can try to use variable. But I don't think that it will be noticeably quicker.

Milda