Excel Power Pivot DAX function Multiple Sheets

Copper Contributor

Hi there!
I have a problem with DAX function in power pivot.
I have loaded 2 tables in 2 different sheets in the power pivot.
I need to write a function in table1 BadgeRecords which make a comparison with data located in table2 LeaveReq.
I will need to use a nested if I think, which sintax in Dax should be like the following:

=IF(condition1,result1,IF(condition2,result2,result3))

 

My function added in an extra column in BadgeRecord sheet looks like this but returns an error that's caused by the LeaveReq[FROM DATE] field located in table 2 and I'm not getting why, I'm not sure I'm missing something.

 

=if(BadgeRecords_bk[Leave]= FALSE(); 0; IF(BadgeRecords_bk[Date]=LeaveReq[FROM DATE];1))

 

Any suggestion?

 

Consider I have BadgeRecords table which records entry and exit date and time of each employee,
the other table LeaveReq it's a list of Holiday requests from each employee.
In order not to record a late arrival if an employee took holiday or permit leave that day I should consider also that.


So First IF condition says true or false if Employee Name in first table is found in the Leave Request table.
If it founds it then it should check the date of the holiday request in the secod table if it matches the one in the first table, if the date it's the same it should not consider he was late that day cause he took a permit.


So firstly it goes i the second table to check employee code if took any permit request 

 

Marcio86_1-1589536493501.png

 

If first condition is true When finds the first record check if the date in LeaveReq table is the same of the on in BadgeRecord

 

Marcio86_2-1589536741044.png

 

Leave Req Table looks like this

 

Marcio86_3-1589536915052.png

 

 

 

 

 

 

 

 

1 Reply

@Marcio86 

That's not enough information, but perhaps you don't have 1 to many relationship between Leave Req and BadgeRecords, with it use RELATED in formula.