Forum Stats

  • 3,767,751 Users
  • 2,252,713 Discussions
  • 7,874,327 Comments

Discussions

How to show Values in stacked bar chart

PhilMan2
PhilMan2 Member Posts: 361 Bronze Badge

I'm using Apex 19.1 on an 18.c database.

I have a stacked bar chart with two series: Online and In-Person. Each have their own SQL.

Online SQL:

Select
     ls.prim_key
   , ls.weekday
   , to_char(ls.liturgy_date, 'MON-DD-YYYY') as "Liturgy_Date"
   , ls.count_online
   , 'Online' series
From 
     LITURGY_STATS ls
Where
   ls.prim_key is not null And
   ls.liturgy_date > to_date('01-JAN-2021', 'dd-mon-yyyy') And
   ls.weekday in ('Sat', 'Sun')
Order by
   ls.liturgy_date;

In-Person SQL:

Select
     ls.prim_key
   , ls.weekday
   , to_char(ls.liturgy_date, 'MON-DD-YYYY') as "Liturgy_Date"
   , ls.count_in_person
   , 'Online' series
From 
     LITURGY_STATS ls
Where
   ls.prim_key is not null And
   ls.liturgy_date > to_date('01-JAN-2021', 'dd-mon-yyyy') And
   ls.weekday in ('Sat', 'Sun')
Order by
   ls.liturgy_date;

The difference between the two queries is ls.count_onilne and ls.count_in_person.

This produces the following stacked bar chart. I'd like to change the results. For each bar, I'd like to see the count_online, count_in_person and All Attendees. The All Attendees value would be something like:

 nvl(ls.count_in_person, 0) + nvl(ls.count_online,0 ) as "All Attendees"

How can I get all three values to show up for each bar?


Tagged: