Forum Discussion

Kurt4597's avatar
Kurt4597
Helper I
3 years ago
Solved

Conditional Column based on link between 2 other tables

Hello PowerBI Community, I am stuck on a problem and would be very greatful if somebody could assist me.

 

Table 1 - Customer List

 

 

Table 2 - Order

 

Table 3 - Fruit Prices

 



 

 

Customer List is linked to Orders based on customer ID
Orders linked to fruit prices based on fruit

 

 

I am trying to create a conditional column in the customer list table to determine if the orders created could meet a certain criteria. For example 


If an order from the customer contains an apple, OR if they have ordered a fruit with price > 2 then TRUE else FALSE

The end result would be an additional column on the customer list table containing true / false values.

 

Any help would be massively appreciated!

sample file https://easyupload.io/jcpe8c

  • You can create a column like

    Meets condition = 
    var filteredOrders = FILTER( 
        RELATEDTABLE(Orders),
        Orders[Fruit] = "Apple" || RELATED('Fruit Prices'[Price]) > 2
    )
    return NOT ISEMPTY( filteredOrders )

1 Reply

  • You can create a column like

    Meets condition = 
    var filteredOrders = FILTER( 
        RELATEDTABLE(Orders),
        Orders[Fruit] = "Apple" || RELATED('Fruit Prices'[Price]) > 2
    )
    return NOT ISEMPTY( filteredOrders )