Filter a parent table based on yes/no values in referenced child table

Hello, 

I'm trying to make a format rules (but this can be useful in filters as well) where I want to highlitgh a row from a  parent table based on a yes/no value contained in N child records. The logical process should be:

This row should be orange because one or more of its child records on a referenced table are marked as "true".

Thanks in advance

0 8 439
8 REPLIES 8

If understanding of your requirement is correct, an expression in the parent table's virtual column can be

IN ( TRUE, [Related Children][Y/N column in child table])

This expression will turn true if any one or more of the parent record's children records have a TRUE value in a Y/N type column.

Where [Related Children] is the reverse reference column in the parent table and [Y/N column in child table] is the column in child table where Y/N status is recorded.

 

in my case the expression is like that:

IN(FALSE;Campagne[Status])

But I wonder if this expressions checks for all the child records in the list Campagne[Status] and if one is FALSE it higlights every row in the parent table since this rule is applied to the parent table.

Could you update what is Campagne - a child table or slice?

If so, it will list status column for all records in the slice or table, not necessarily related child records of a single parent. 

If you are looking for setting the status of a parent based on only its own child records, then use of rev reference coumn is imperative.

  • "Campagne" is a child table of "Distretti".
  • There can be multiple "Campagne" 
  • Two columns in "Campagne" called [Status] and [Status 2] are yes/no types
  • I want to higlights "Distretti" rows if one of the child "Campagne" have [Status]=FALSE and [Status 2]=True

I need to come up with a yes/no expression to use in "Distretti" table to highlights "Distretti" records

Is it child 1 [Statu] = FALSE and child 1 [Status 2]= TRUE, meaning any single one child record's these statuses should be checked or any child record's combination to be checked? Meaning Child 1 [Status 2]= FALSE and child 4 [Status]= TRUE will do to flag the parent record?

Found this solution, but could impact performance:

  • Used a slice of "Campagne" called "Campagne in corso" where [Status]=FALSE and [Status 2]=True
  • Used this format rule in "Distretti" table: COUNT(REF_ROWS("Campagne in corso";Codice distretto))>0

The logic is to count if there are any referenced rows that are allowed and if there is one highlight the parent record

Where codice distretto is the key value for the referenced table "Campagne


@Gianlucapozza wrote:

COUNT(REF_ROWS("Campagne in corso";Codice distretto))>0


You could instead try 

ISNOTBLANK([Rev ref column on slice]) because reverse reference column is anyway system generated.

 

 

 

 

 

This could be a similar problem:

I have this table with referenced records (first row has 5 ref records):

Gianlucapozza_0-1689691277247.png

Heres the detail of the first row:

Gianlucapozza_1-1689691357241.png

 

What I want to to do is filter the rows from the first table based on the ref records in the detail. Specifically I want to show the record only if one of the ref records was made in a date time [Timestep]>TODAY()-n since I'm creating a dashboard in wich I want to show only records made too often in a precise timestep.

Top Labels in this Space