1 2 Previous Next 15 Replies Latest reply on Sep 30, 2013 1:39 AM by Dawid Nawrot

# Line graph - each day as a separate line

I have a set of data and want to compare few measures across different days. For example:

1. Income

a) last 7 days

b) today compared to the same day last week

etc..

How do I create separate line for each day? I connected my Tableau to the SQL Server and get the data. I filtered it so it only asks for last 14 days, but that's as far as I got. Any help please?

• ###### 1. Re: Line graph - each day as a separate line

I'm not sure what you mean by "separate line for each day".  Can you post a packaged workbook with some data demonstrating what you are trying to accomplish, and maybe a mockup of what it would look like?

• ###### 2. Re: Line graph - each day as a separate line

Unfortunately I can't post anything but let's assume following scenario:

I have a spreadsheet for last week outlining number of sales with timestamp. I group it by hour so I have 24 rows for each day. Now I would like to create a graph where Today, Yesterday and day before Yesterday are on the same graph but different colours, in order to see variations in each hour.

Let's say I'll notice that today at 11am we had 50% less sales than yesterday, having it on one graph I can tell something went wrong..

• ###### 3. Re: Line graph - each day as a separate line

Dawid, what Matthew said. But you're probably looking for Measure Names & Measure Values.

--Shawn

• ###### 4. Re: Line graph - each day as a separate line

You could mock up the scenario using the sample data provided by Tableau.  I'm certain what you want can be done, but I don't have enough experience to resolve the problem in my head.

• ###### 5. Re: Line graph - each day as a separate line

Hi,

I've populated data with some random numbers:

The green is a number of sales, orange - moving average, grey - percentage deviation to previous day.

How can I change the size of the orange line? They are grouped with green in Measure Names at the moment?

• ###### 6. Re: Line graph - each day as a separate line

If I understood your requirement correctly you can make it by creating 1 calculated field and Percentage Difference Table Calculation.

Hour : Str(Datepart('hour',[SaleDate]))

Please find the attached sample workbook,Hope this will help..

• ###### 7. Re: Line graph - each day as a separate line

Is it correct to think that theoretically to create multiple values' lines on one graph it's best to use calculated fields instead measure values/names. Does Measure Value/Name group values together and all styles/calculations are applied to all of them (hence my problem with changing just one value's colour?)

• ###### 8. Re: Line graph - each day as a separate line

I tend to abide by this but it just depends on what you need as an end result.  Measure values/names can be powerful in other ways.

• ###### 9. Re: Line graph - each day as a separate line

I know I side-tracked from my original question a little bit. I think I've managed to put few days onto one graph but not very dynamically.

Just like I have simple line of number of sales for a day, I would like to be able to dynamically put 4 more lines of the same day of the week, but 4 weeks in the past.

• ###### 10. Re: Line graph - each day as a separate line

It will always depends on how you want to visualize your data.

for example : You want to create a table with 3 columns CY sales, LY sales and CY vs LY Variance as third column.

Option 1: Use Calculated fields for three of them,

Option 2: Put multiple year values from time dimension then add percentage variance table calculation, You will end up in 4 columns Cy,LY,Blank,%Variance.

most of the business users prefer option 1. So decisions are made upon the viz requirement.

• ###### 11. Re: Line graph - each day as a separate line

Hi I used your earlier example and I got last 7 days as separate lines.

I presume I can't edit settings for one day only now, can I? I only need label for today's date for example

• ###### 12. Re: Re: Line graph - each day as a separate line

Hi You can use custom calculation as well. you can find it in the attached workbook.

If we use this method challenge is display the variance between each days. (In my workbook today sales will be blank because no data for today)

Today Sales= If date([SaleDate])= Date(now()) then [Sales] end

Yesterdays Sales=If date([SaleDate])= date(now()-1) then [Sales] end

Day Before Yesterday= If date([SaleDate])= date(now()-2) then [Sales] end

• ###### 13. Re: Line graph - each day as a separate line

How can I make sure that the most recent line (I managed to do ordering of labels) is always in front of other lines?

• ###### 14. Re: Line graph - each day as a separate line

Change the sort order for that field:

I right clicked on the field on the color shelf to do this--your workbook is re-attached

1 2 Previous Next