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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
pmadam
Helper II
Helper II

Apply filter in Union Table

Hi Team

 

Is it possible for me to remove rows from a union table created in Dax based on the value of a column?  Need to remove so table has unique values so I can use the Related function.  Currently many to many.

 

From 'UNIONTABLE-BKM-NDC' I think I want to remove all rows where the value in column 'APPR DATE CHECK' is "NOT OLDEST DATE'. I think this should leave me with only unique values.... 

 

_APPR DATE CHECK = IF('UNIONTABLE-BKM-NDC'[AddedDate]= CALCULATE(MIN('UNIONTABLE-BKM-NDC'[AddedDate]),ALLEXCEPT('UNIONTABLE-BKM-NDC','UNIONTABLE-BKM-NDC'[OrderNumber])),"OLDEST DATE","NOT OLDEST DATE")
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @pmadam ,

 

According to your statement, I think "UNIONTABLE-BKM-NDC" is an UNION table by dax. [_APPR DATE CHECK] should be a calculated column to return flag based on some conditions.

You can create a virtual table and filter it.

UNIONTABLE-BKM-NDC =
VAR _BASIC_UNION =
    UNION ( 'Table1', 'Table2' )
VAR _ADD_APPR_DATE_CHECK =
    ADDCOLUMNS (
        _BASIC_UNION,
        "_APPR DATE CHECK",
            IF (
                [AddedDate]
                    = MINX (
                        FILTER ( _BASIC_UNION, [OrderNumber] = EARLIER ( [OrderNumber] ) ),
                        [AddedDate]
                    ),
                "OLDEST DATE",
                "NOT OLDEST DATE"
            )
    )
VAR _FILTER =
    FILTER ( _ADD_APPR_DATE_CHECK, [_APPR DATE CHECK] <> "NOT OLDEST DATE" )
RETURN
    _FILTER

 

Best Regards,
Rico Zhou

 

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
Anonymous
Not applicable

Hi @pmadam ,

 

According to your statement, I think "UNIONTABLE-BKM-NDC" is an UNION table by dax. [_APPR DATE CHECK] should be a calculated column to return flag based on some conditions.

You can create a virtual table and filter it.

UNIONTABLE-BKM-NDC =
VAR _BASIC_UNION =
    UNION ( 'Table1', 'Table2' )
VAR _ADD_APPR_DATE_CHECK =
    ADDCOLUMNS (
        _BASIC_UNION,
        "_APPR DATE CHECK",
            IF (
                [AddedDate]
                    = MINX (
                        FILTER ( _BASIC_UNION, [OrderNumber] = EARLIER ( [OrderNumber] ) ),
                        [AddedDate]
                    ),
                "OLDEST DATE",
                "NOT OLDEST DATE"
            )
    )
VAR _FILTER =
    FILTER ( _ADD_APPR_DATE_CHECK, [_APPR DATE CHECK] <> "NOT OLDEST DATE" )
RETURN
    _FILTER

 

Best Regards,
Rico Zhou

 

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

tamerj1
Super User
Super User

@pmadam 
This should work for a calculated column. What results are you getting?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors