'Kusto project only non null values or drop columns with null values

When I query, I get a row, with multiple null values. is there a way to either not get null values in the result, or drop the columns with null values?

sample code is:

let table_name = datatable(name:string, date_part:datetime, job_1:string, job_2:string, job_3:string, job_4:string)
[
     "David", datetime(2022-05-9), "Architect", "", "", "Engineer"
  
];
table_name 
|where name == "David" and (date_part  between (now() .. -10d))
|project  (job_1),(job_2),(job_3),(job_4)

Thank you!



Solution 1:[1]

let table_name = datatable(name:string, date_part:datetime, job_1:string, job_2:string, job_3:string, job_4:string)
[
     "David", datetime(2022-05-9), "Architect", "", "", "Engineer"
    ,"David", datetime(2022-05-6), "Musician", "Producer", "", ""
];
table_name 
| where name == "David" and (date_part  between (now() .. -10d))
| project-keep job_*
| evaluate narrow()
| where isnotempty(Value)
| evaluate pivot(Column, any(Value), Row)
| project-away Row
job_1 job_2 job_4
Architect Engineer
Musician Producer

Fiddle

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1