Can I hide a column ? Like in that table I want to hide all that columns which contains only zeros. I want to show only those columns which contains some value

Like in that table I want to hide all that columns which contains only zeros. I want to show only those columns which contains some value. So that I can remove all that unnecessary columns which do not contain any value

@jornh can you help me out?

No not really without going through a lot of guessing … other than “it depends” on how you built the question that gives the output you shared a screenshot of. And you didn’t share any details on that.

SELECT
jiraissue.Assignee,
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-04-%' THEN 1 END) AS '/04/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-05-%'  THEN 1 END) AS '/05/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-06-%'  THEN 1 END) AS '/06/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-07-%'  THEN 1 END) AS '/07/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-08-%'  THEN 1 END) AS '/08/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-09-%'  THEN 1 END) AS '/09/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-10-%'  THEN 1 END) AS '/10/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-11-%'  THEN 1 END) AS '/11/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-12-%'  THEN 1 END) AS '/12/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-01-%' THEN 1 END) AS '/01/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-02-%'  THEN 1 END) AS '/02/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-03-%'  THEN 1 END) AS '/03/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-04-%'  THEN 1 END) AS '/04/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-05-%'  THEN 1 END) AS '/05/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-06-%'  THEN 1 END) AS '/06/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-07-%'  THEN 1 END) AS '/07/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-08-%'  THEN 1 END) AS '/08/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-09-%'  THEN 1 END) AS '/09/2019',

COUNT(CASE WHEN jiraissue.DUEDATE BETWEEN date('2018-04-01 12:00:00') AND 
('2019-09-30 23:59:59') THEN 1 END) AS 'GRAND-TOTAL'
FROM jiraissue
INNER JOIN issuetype
ON jiraissue.issuetype = issuetype.ID
INNER JOIN issuestatus
ON jiraissue.issuestatus = issuestatus.ID
WHERE
issuestatus.pname = 'In Progress' AND
issuetype.pname in ('Minor Enhancement', 'Root Cause Analysis', 'Support Demand 
Request')
group by Assignee
union

select 'GrandTotal' as Assignee,
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-04-%' THEN 1 END) AS '/04/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-05-%' THEN 1 END) AS '/05/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-06-%' THEN 1 END) AS '/06/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-07-%' THEN 1 END) AS '/07/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-08-%' THEN 1 END) AS '/08/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-09-%'  THEN 1 END) AS '/09/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-10-%'  THEN 1 END) AS '/10/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-11-%'  THEN 1 END) AS '/11/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2018-12-%'  THEN 1 END) AS '/12/2018',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-01-%' THEN 1 END) AS '/01/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-02-%'  THEN 1 END) AS '/02/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-03-%'  THEN 1 END) AS '/03/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-04-%'  THEN 1 END) AS '/04/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-05-%'  THEN 1 END) AS '/05/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-06-%'  THEN 1 END) AS '/06/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-07-%'  THEN 1 END) AS '/07/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-08-%'  THEN 1 END) AS '/08/2019',
COUNT(CASE WHEN jiraissue.DUEDATE like '2019-09-%'  THEN 1 END) AS '/09/2019',


COUNT(CASE WHEN jiraissue.DUEDATE BETWEEN date('2018-04-01 12:00:00') AND 
('2019-09-30 23:59:59') THEN 1 END) AS 'GRAND-TOTAL'
from jiraissue

INNER JOIN issuetype
ON jiraissue.issuetype = issuetype.ID
INNER JOIN issuestatus
ON jiraissue.issuestatus = issuestatus.ID
WHERE
issuestatus.pname = 'In Progress' AND
issuetype.pname in ('Minor Enhancement', 'Root Cause Analysis', 'Support Demand 
Request') 

HEY @jornh here is my code

Phew, that’s an awful lot of SQL (at least for me :face_with_head_bandage: - not my strong point …)

Instead of hunting for at “hide this column” button which is AFAIK currently not there for SQL questions, what if you simply rephrase the problem into adding another SQL condition with:

  • "Only show a column WHERE GrandTotal > 0"

I don’t know exactly how to add that condition to your SQL, maybe you can figure it out, or maybe some SQL guru around here can jump in to the conversation?

HTH

@jornh Did someone say SQL? :stuck_out_tongue_winking_eye:

The problem with the original query is that it’s horrible. You shouldn’t have a column for each month. Imagine maintaining this over several years :sob:
The count should just be grouped by month. Then the rows with zeroes won’t even exist. The metabase table can be pivoted so that months appear over the top.

1 Like

Looking at your data, you don’t need to use SQL, just the regular question builder. This does something similar (it’s pivoted this was as I have only a few countries displayed)


Much easier to maintain and any months with missing values are hidden (March-November 2015 are all absent).

If you simply want to hide columns that will appear as question output, select the Show/Hide Editor icon in the upper right (3 dots and 3 bars), see screenshot. Then from the next page, you’ll see Data in a highlighted row with Columns at the end. Click on the word Columns and you’ll be able to select which columns you want to appear using the tickboxes, see screenshot.

Sorry, new user so I could only include one screenshot per comment. Here’s the screenshot for the first instruction.