Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to show data of last 7 days in bar chart

Hi,

I have an order table with a field OrderDate, a field Units and a field Price.

I created a bar chart and used OrderDate as dimension and sum(Units*Price) as measure.

The bar chart now shows all the order dates and the sum of Unit*Price for each day.

What I want to achieve is, that the bar chart only shows the last 7 days before today.

What is the best way to achieve this?

1 Solution

Accepted Solutions
r_wroblewski
Partner - Creator III
Partner - Creator III

Hi Dirk

if you using Qlik Sense, you can achieve what you want only by Set Analysis because you don't have the same options like in QlikView.

e.g.

Sum({$<OrderDate={">=$(=Today()-7)<=$(=Today()-1)"}>}Units*Price) (when your date field is in num format e.g 42151)

or

Sum({$<OrderDate={">=$(=Date(Today()-7))<=$(=Date(Today()-1))"}>}Units*Price) (when in date format e.g.  YYYY/MM/DD )


Let me know if it's working or not.

If not, it would be good to share some sample data if possible.


Regards,

Ronny

View solution in original post

10 Replies
swuehl
MVP
MVP

A simple approach would be to sort Date desc, then go to dimension limit tab and enable 'Restrict which values..' using option 'Show only first 7 values'.

You can also limit the dimension values by a calculated dimension or by a set expression in your aggregation expression.

Michael_Tarallo
Employee
Employee

Hello Dirk,

Do you want this from QlikView or Qlik Sense? I believe what Stefan is describing is for QlikView.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
r_wroblewski
Partner - Creator III
Partner - Creator III

Hi Dirk

if you using Qlik Sense, you can achieve what you want only by Set Analysis because you don't have the same options like in QlikView.

e.g.

Sum({$<OrderDate={">=$(=Today()-7)<=$(=Today()-1)"}>}Units*Price) (when your date field is in num format e.g 42151)

or

Sum({$<OrderDate={">=$(=Date(Today()-7))<=$(=Date(Today()-1))"}>}Units*Price) (when in date format e.g.  YYYY/MM/DD )


Let me know if it's working or not.

If not, it would be good to share some sample data if possible.


Regards,

Ronny

Michael_Tarallo
Employee
Employee

Dirk,

Ronny is correct - he beat me to it - if you are new to Set Analysis - you can learn more here:

A Beginners' Introduction to Set Analysis (video) - Part 1 and 2

Available from this series: New to Qlik Sense Videos

Please mark the appropriate replies as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik
r_wroblewski
Partner - Creator III
Partner - Creator III

Hi Michael

To say that I beat you is a bit exaggerated. I was maybe a little bit faster with typing this time.

But I also learnt this just from this great community.

e.g.

A Primer on Set Analysis

from hic

Best regards,

Ronny

Not applicable
Author

Hi guys,

yes, I use Sense. Sorry for not mentioning.

Perfect! Ronnys 2nd Set Analysis expression did it for me.

I had tried a rather similar expression before my post here but couldn't do it. I'm still struggling a bit with the syntax of the set analysis, though I read and watches almost all the posts, videos and docs about it. But I am learning and you showed me a great way to achieve my goal. Thanks for that.

Seeing that this community is really working very well, I hope you can help me using this discussion board in the right way. Some days ago I posted a question in the sense app development forum (problem with master calendar and filtered data) and did not get any answer until now. I fear that I perhaps should have posted it in the New to Click Sense forum instead or that I did something wrong in my description. Do you think I should re-post this in the New to forum or change my question?

Thanks again

Dirk

r_wroblewski
Partner - Creator III
Partner - Creator III

Hi Dirk,

good to hear that the expression works.

I`m a little bit busy now but I will check your other post & will let you know when I find a solution or a good reason why it's not working. ^^

Regards,

Ronny

Not applicable
Author

Thanks Ronny

Michael_Tarallo
Employee
Employee

Hi Drik,

All Qlik Community discussions display in a list in the appropriate section, it depends on which members are monitoring or following. I monitor the New to Qlik Sense section on a regular basis and will get an alert when a new post is placed, I try to help as many people as possible and only to get to so many in addition to "Qlik" related work. 🙂  However, feel free to reach out to a moderator / admin such as myself mto‌ anytime. I'll do my best to help, or at least put a set of eyes on ti.

Please mark Ronny's reply as CORRECT / HELPFUL so our team and other members know that your question(s) has been answered to your satisfaction.

Regards,

Mike Tarallo

Qlik

Regards,
Mike Tarallo
Qlik