cancel
Showing results for
Did you mean:
Super User

## Calculate column with TRUE or FALSE values, according to values held in parent AND child table

Table 1 has ID and a date, and in this table I want to add a calculated column.
Table 2 is a child of table 1 (FK is table1.ID), has its own ID and has a text column.

The calculated column is to be TRUE or FALSE according to the value of table1.date (>= 01/10/2021 & <= 30/11/2021) AND whether table2.text has values of "VALUE A" OR "VALUE B".
I've tried IF with LOOKUPVALUE etc... and get the (expected) "A table of multiple values was supplied where a single value was expected" error.

I cannot fathom which DAX function to use for this...

1 ACCEPTED SOLUTION
Super User

@RichHead1821 , If you need a new column in table A

New column =

var _cnt = countx(filter(TableB, TableB[value] in {"VALUE A" , "VALUE B"}), [Value]) +0

return

if(_cnt >0 && Table1[Date] >= date(2021,10,01) && Table1[Date] <= date(2021,11,30), true(), false() )

2 REPLIES 2
Super User

Perfect, thank you sir, also able to follow and understand.

Super User

@RichHead1821 , If you need a new column in table A

New column =

var _cnt = countx(filter(TableB, TableB[value] in {"VALUE A" , "VALUE B"}), [Value]) +0

return

if(_cnt >0 && Table1[Date] >= date(2021,10,01) && Table1[Date] <= date(2021,11,30), true(), false() )

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

#### Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors