Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in BI by (17.6k points)

New to Tableau so sorry if this is obvious, but I had a hunt and couldn't find/understand anything. So I have a cake shop and I want to know if people have purchased both éclairs and Eccles cakes in the same order

ORDER ID     item 

0001         éclair

0001         iced bun

0001         Eccles cake

0002         éclair 

0002         iced bun

0003         éclair          

0003         Eccles cake   

What I want as an output is the following:

ORDER ID     item          éclair?

0001         éclair          0

0001         iced bun        0

0001         Eccles cake     1

0002         éclair          0

0002         iced bun        0

0003         éclair          0

0003         Eccles cake     1 

I'm thinking it requires something like a lookup or a helper column?!

For reference, I've got a single data set (a csv file) so I'm guessing I can't run a SQL query on it? 

1 Answer

0 votes
by (22.5k points)
edited by

 

  1. In a row, section add order Id and Item

  2. Create two copies A and B by right-clicking the data source and duplicate the original data source

  3. Select the item field and unlink it

  4. By clicking on the data source b create a calculated felid by the formula

    MAX(IF [Item] = 'éclair' THEN 1 ELSE 0 END) MAX(IF [Item] = 'Eccles cake' THEN 1 ELSE 0 END)

  5. In data source A . 

IF ATTR([Item]) = 'Eccles cake' AND [Data Source B].[Eclair Flag] = 1 AND [Data Source B].[Cake Flag] = 1 THEN 1 ELSE 0 END

If you want to learn more about it Tableau, then go through this Tableau Training for more insights.   

Related questions

0 votes
1 answer
asked Apr 8, 2020 in BI by Anup (1.6k points)
0 votes
1 answer
asked Jul 22, 2019 in BI by Vaibhav Ameta (17.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Dec 9, 2020 in BI by Chris (11.1k points)

Browse Categories

...