Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
GaryChin
Contributor III
Contributor III

How to show only last month data on a line chart

Hi All,

I would like to only show the last month data on a line chart.

The field name and content are "measure_time" and "MM/DD/YYYY hh:mm:ss AM"

Any idea of the expression?

 

Best & Regards

Gary

Labels (1)
1 Solution

Accepted Solutions
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

I have created some 4 different charts you can use

PFA 

Thanks

Thanks and Regards
Kashyap.R

View solution in original post

9 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Do you have month field in your data? If yes,

Try this:

=SUM({<measure_month={"$(=month(addmonths(max(measure_time),-1)))"}>} measure)

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

if you have the date try this

=SUM({<Date={">=$(=monthstart(addmonths(max(Date),-1)))<=$(=monthend(addmonths(max(Date),-1)))"}>} measure)

hope this helps

Thanks

Thanks and Regards
Kashyap.R
GaryChin
Contributor III
Contributor III
Author

Sorry. I don't have month field in my data

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

You can use the date in the expression

just replace the Date with your Date column

and measure with your Measure column

Thanks

Thanks and Regards
Kashyap.R
GaryChin
Contributor III
Contributor III
Author

I have 3 field: measure_time, measure_point, measure_value

I binding the measure_time to the Dimensions Field of Line Chart

binding.PNG

In the Measure Field the syntax shown below:

=sum({<measure_time={">=$(=monthstart(addmonths(max(date),-1)))<=$(=monthend(addmonths(max(date),-1)))"}>} measure_value)

or 

=sum({<measure_time={">=$(=monthstart(addmonths(max(measure_time),-1)))<=$(=monthend(addmonths(max(measure_time),-1)))"}>} measure_value)

or 

=sum({<Date={">=$(=monthstart(addmonths(max(measure_time),-1)))<=$(=monthend(addmonths(max(measure_time),-1)))"}>} measure_value)

The line chart also no change

test4.PNG

 

I just want to show Dec data.

Thanks

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Can u share the QVF I will see what is actually not working

Thanks

Thanks and Regards
Kashyap.R
GaryChin
Contributor III
Contributor III
Author

Sure. Here is the QVF and data

 

Kashyap_R
Partner - Specialist
Partner - Specialist

Hi 

I have created some 4 different charts you can use

PFA 

Thanks

Thanks and Regards
Kashyap.R
GaryChin
Contributor III
Contributor III
Author

Thank You!