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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Virtual table with crossjoin

Hello all!

I've been struggling with this one:

 

Below is an example of the tables I have:

TablesTables

And that's the expected result I want to achieve:

Expected calculated tableExpected calculated table

For now, I have created a calculated table with the following DAX:

 

Table = 
CROSSJOIN(
VALUES(Employees Table[Employee_ID]), 
VALUES(PPE Table[PPE])
)

 

With the above, I have a table with all the Employee_IDs and all the PPEs. Also, I was able to create calculated columns with another DAX expressions to lookup for Employee_Name, Function_Area and the Last Delivery Date. But yet I can't create the column that tells me if the PPE is mandatory based on that Function_Area, as per my example above.

 

The goal is to display which employees have their PPEs ok -- meaning they have what they need and are mandatory for 'em -- and the ones who don't.

 

Thanks in advance.



1 REPLY 1
AlB
Community Champion
Community Champion

Hi @Anonymous 

If you have this table as described:

 

Table1 = 
CROSSJOIN(
VALUES(Employees Table[Employee_ID]), 
VALUES(PPE Table[PPE])
)

 

 you can add a column specifying whether the equipment is compulsory for that function:

Table2 =
ADDCOLUMNS (
    CROSSJOIN ( VALUES ( EmployeesTable[Employee_ID] ), VALUES ( PPETable[PPE] ) ),
    "IsCompulsory",
        VAR currentID_ = EmployeesTable[Employee_ID]
        VAR currentfunction_ =
            CALCULATE ( DISTINCT ( EmployeesTable[Function_Area] ) )
        RETURN
            PPETable[PPE]
                IN CALCULATETABLE (
                    DISTINCT ( PPETable[PPE] ),
                    PPETable[Function_Area] = currentfunction_,
                    ALL ( PPETable[PPE] )
                )
)

 

Please always show your sample data in text-tabular format in addition to (or instead of) the screen captures. A screen cap doesn't allow people to readily copy the data and run a quick test and thus decreases the likelihood of your question being answered. Just use 'Copy table' in Power BI and paste it here. Or, ideally, share the pbix (beware of confidential data).

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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