Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
finn881988
Frequent Visitor

Filter on the results generated by another filter

I have a Monthly Table has such info: customerID, transactionTimeStamp, OrderStatus, OrderType, etc.

customerIDtransactionTimeStampOrderStatusOrderType
1111112022-12-12THSK
1111112022-12-12PSK
1111112022-12-12XSK
1111112022-12-13PAU
222222....  

 

I'd like to get:

Step1: all customers who placed AU order and has OrderStatus = P.

Step2: use the customer list to find the very LAST SK type order with status in TH among all these customers extracted from step1.

 

The output should be one TIMESTAMP.

 

Any help is appreciated!

(I tried to use two layers filter function but ended up with error saying: A single value for column cannont be determmined. This can happen when a measure formula refers to a column that contains many values.) 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @finn881988 

 

You can try the following methods.

vzhangti_0-1672988806493.png

Measure = 
VAR _table =
    FILTER (
        SUMMARIZE ('Table',
            'Table'[transactionTimeStamp],'Table'[OrderStatus],'Table'[OrderType],
            "customerID",
                CALCULATE ( MAX ( 'Table'[customerID] ),
                    FILTER ( ALL ( 'Table' ),
                        [OrderType] = "AU" && [OrderStatus] = "P"
                            && [customerID] = SELECTEDVALUE ( 'Table'[customerID] ) ) ) ),
        [customerID] <> BLANK ()
    )
RETURN
    MAXX ( FILTER ( _table, [OrderType] = "SK" && [OrderStatus] = "TH" ),
        [transactionTimeStamp]
    )

vzhangti_1-1672988835399.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @finn881988 

 

You can try the following methods.

vzhangti_0-1672988806493.png

Measure = 
VAR _table =
    FILTER (
        SUMMARIZE ('Table',
            'Table'[transactionTimeStamp],'Table'[OrderStatus],'Table'[OrderType],
            "customerID",
                CALCULATE ( MAX ( 'Table'[customerID] ),
                    FILTER ( ALL ( 'Table' ),
                        [OrderType] = "AU" && [OrderStatus] = "P"
                            && [customerID] = SELECTEDVALUE ( 'Table'[customerID] ) ) ) ),
        [customerID] <> BLANK ()
    )
RETURN
    MAXX ( FILTER ( _table, [OrderType] = "SK" && [OrderStatus] = "TH" ),
        [transactionTimeStamp]
    )

vzhangti_1-1672988835399.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

FreemanZ
Super User
Super User

hi @finn881988 

try to write a measure like this:

TimeStampe = 
VAR _customerlist =
CALCULATETABLE(
    VALUES(TableName[customerID]),
    FILTER(
        TableName,
        TableName[OrderStatus]="P"
            &&TableName[OrderType]="AU"
    )
)
VAR _table =
FILTER(
    TableName,
    TableName[customerID] IN _customerlist
)
RETURN
MAXX(
    FILTER(
       _table,
            TableName[OrderStatus]="TH"
            &&TableName[OrderType] = "SK"
    ),
    TableName[TransactionTimeStamp]
)

 

i tried with an expended dataset and it worked like this:

FreemanZ_0-1672966516126.png

FreemanZ_1-1672966545662.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.