Hide column without having values in cell

How to hide the column which does not have value in cells?

Hi @MetroN ,
Have you tried with Override - Hide in table ?

This will hide a column in table but you will still be able to use values from that column in data links.

 

Best regards,
ldrascic

This is not what I’m asking. I need to hide column only without the data.

What is your datasource and version of grafana

Also how do you define cells without data

Is it empty string null or ?

Data store is MSSQL. empty shell is defined as null.

This is more of mssql query than grafana issue

I would first off use a stored procedure for this if possible

Then using dynamic query hide the column wherein the sum of the column is null. Or you can use a temp table that to modify the final table schema

something like this using just mock data

declare @sql varchar(max) = 'SELECT SubCategory, ';

create table #grafana(
  SubCategory varchar(50),
  Opened int,
  Closed int,
  InProgress int
)

insert into #grafana
select 'Cheese Puffs', 0,1,null union
select 'Doritos', 0,1,null union
select 'Sambussa', 0,1,null

create table #summation(
  Opened int,
  Closed int,
  InProgress int)

insert into #summation
select sum(Opened) as Opened,
       sum(Closed) as Closed,
  sum(InProgress) as InProgress
  from #grafana

if not exists(select 1 from #summation where Opened is not null)
begin
--set @sql = concat(@sql, ' Opened ')
ALTER TABLE #grafana DROP COLUMN Opened
end

if not exists(select 1 from #summation where Closed is not null)
begin
--set @sql = concat(@sql, ', Closed ')
ALTER TABLE #grafana DROP COLUMN Closed
end

if not exists(select 1 from #summation where InProgress is not null)
begin
--set @sql = concat(@sql, ', InProgress ')
ALTER TABLE #grafana DROP COLUMN InProgress
end

--set @sql = concat(@sql, ' from #grafana ')

--exec(@sql)

select * from #grafana

drop table #summation
drop table #grafana

last column InProgress has all rows as null so it wont show up in table