1

I am trying to create a stacked bar chart between 2 dimensions (one being week, other is a string - more below) and 1 measure. I am new to Looker.

But in order to get the stacked bar chart I figure that I need to

  • Create a pivot
  • Transpose the data
  • Create stacked bar chart

I am stuck with step 2 and 3. The above steps is what I have thought could help me arrive at the visualization I want but would appreciate if there is any other solution for this.

Scenario: I have a digital marketing data with me, where I am trying to create a visualization on ‘Leads’ generated,

I have 2 dimensions, 1 measure

  1. Lead Created Week - Week on which a lead was created
  2. Reason2 - reason a lead was created or what reason attracted the user most
  3. Leads - count of leads

I have plotted the below visualization where I have created a pivot of week with Reason2 and Lead count under it and have plotted it on a stacked bar chart (as below).

Where each bar is a Reason (X-axis) and each color is the Week dimension, leads (count of leads) is in the Y-axis

screenshot 1

Even though this is help what would be helpful is having ‘Week’ on X-axis, ‘Leads’ (count of leads) on Y-axis and ‘Reasons2’ dimension as a legend.

There is also one catch i.e., there are more than 100 distinct values in ‘Reason2’ field but I need to pick on Top 10 Reasons (i.e., the reasons that generated the most leads), which in the above screenshot I have achieved by limiting the display rows to 10 as the measure was already sorted.

I tried to flip around the pivot by having reason in pivot and Week as dimension, but if now the pivot is sorted in alphabetical manner and not by value of measures (screenshot below), I need the top 10 reasons which most leads per week.

screenshot 2

How do I achieve the desired visualization of having week on X-axis with leads on Yaxis but only the top 10 Reasons should be generated.

halfer
  • 19,824
  • 17
  • 99
  • 186
cyborg
  • 431
  • 1
  • 6
  • 20
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Jul 04 '20 at 11:42
  • @halfer sure thank you. – cyborg Jul 06 '20 at 01:36

0 Answers0