4 Replies Latest reply on Feb 29, 2016 12:14 AM by Matan Bracha

# How to create a Bar-Graph for difference-from-a-week-ago

Hi All,

I want to create a Bar-Graph that shows me the difference in "Views" from last week to today.

I used the LOOOKUP function to create that calculation - ZN(SUM([Views]))-LOOKUP(ZN(SUM([Views])), 7), and when I put it in a table with all the dates, it works great - but how can I show the number without having to show all the dates?

I want the graph to be Views in X-axis and Sites in Y-axis.

Thank you very much

• ###### 1. Re: How to create a Bar-Graph for difference-from-a-week-ago

Matan,

I'm not sure which kind of view you expect for "bar graph" but here is what I can propose.

This shows week ago and (today + delta from week ago)

Create calculated fied of

if [Date]=today() or [Date]=today()-7 then [Date] end

Put

[Date header] in the filter shelf and filter out "Null"

Put [Date header] in the column with MDY format

Put sum(view) in column shelf.

Put sum(view) on secondary axis as gantt chart and synchronize.

Put sum(view) in mark of second axis and change to table calculations as below.

Put Table calculation sum(view) in color and size and "edit in shelf"

then put "-" on top of formula.

Change Color setting

Thanks,

Shin

9.0 attached.

• ###### 2. Re: How to create a Bar-Graph for difference-from-a-week-ago

Which value are you trying to keep?

Table calculations require all the data in the view. Since there is no example dataset, let me propose a solution based on assumptions.

The trick is in table calculation filters. Table calculation filters apply after table calculations are calculated and hide marks. So applying this filter won't change the value you calculated but it will let you hide the bars that you don't want to see.

If you want to only keep the seventh bar you can write a calculated field like INDEX()=7 then use it as a filter and just keep rows that returns True. You will see that your LOOKUP function still returns the same value but marks are not displayed.

• ###### 3. Re: How to create a Bar-Graph for difference-from-a-week-ago

Hi!

second of all, what I need, referring to the workbook you've posted (thank you for that as well), is just the green bars in the sheet. Meaning, I want to compare only the Delta between the sites.

My view needs to show ONLY three bars, where AAAAA = 66, BBBB = 7, CCC = 54.

Is there a way to show those three bars without showing the data for last week?

• ###### 4. Re: How to create a Bar-Graph for difference-from-a-week-ago

What I need to keep is the Delta - lets say something like this:

- 2016-02-22 has 5,000 views for site A, 3,000 views for site B

- 2016-02-29 has 7,000 views for site A, 7,000 views for site B

I want to see 2 bars:

- Site A: 2,000

- Site B: 4,000