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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Adding a condition in distinct union function

Hi everybody,

I am new in Power Bi & appreciate if anyone help me here:

I want to union the codes in 3 seperate tables and set the below formula which works correctly. 

 

Maintenance WO =  DISTINCT(union(FILTER(distinct(' Employee Hours'[Code]),'Employee Hours'[Code]<>""),FILTER(distinct(' Asset Hours'[Code]),'Asset Hours'[Code]<>"")))

 

Now, I want to add another condition for each table:

 

 

Simply, I just want to union the codes of two below tables if in employee table, crew type be MGMT and in Asset table, the crew type be Maint. Off course, empty codes must not be considered.

Capture12.PNG

No idea what to do. your help would be highly appreciated.

 

 

1 ACCEPTED SOLUTION

Hi @Anonymous,

 

It works in my test. Did you make any changes?

Adding_a_condition_in_distinct_union_function

 

Best Regards,

Dale

Community Support Team _ Dale
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

5 REPLIES 5
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

You almost got there. Try the formula below, please.

Table =
DISTINCT (
    UNION (
        CALCULATETABLE (
            VALUES ( Employee[Code] ),
            FILTER (
                Employee,
                ISBLANK ( Employee[Code] ) = FALSE ()
                    && Employee[Crew] = "MGMT"
            )
        ),
        CALCULATETABLE (
            VALUES ( Asset[Code] ),
            FILTER ( Asset, ISBLANK ( Asset[Code] ) = FALSE () && Asset[Crew] = "Maint" )
        )
    )
)

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi 

 

Hi @Anonymous,

 

It works in my test. Did you make any changes?

Adding_a_condition_in_distinct_union_function

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you so much for your time and help Smiley Very Happy

Anonymous
Not applicable

no one has any idea?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.