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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (5,684)