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

DAX formula lookup

Hi, I am very new to DAX ( I have worked some with access formulas so its a little familiar)

I have a column with the expense date. I need help with a dax formula to look up the date in the expense data to a table that contains the payroll run dates  and return the payroll run information. 

The second part of the formula is there are many payroll runs ( such as Domestic , International) So I create an ID for the payroll type too.

 

Table 1-   EXPENSE DATA

   ID                                     Expense date      Payroll Batch ( lookup formula expected answer)

   DOMESTIC                       01/01/2022             1

   International                    01/30/2022             I2

 

Table 2 -PAYBATCH ( lookup table)

   ID                       Start Date     End Date    Payroll batch

Domestic              01/01/22       01/15/22      1

Domestic              01/16/22       01/31/22      2

International        01/05/22        01/20/22     I1

International       01/21/22         02/05/22     I2

 

 

Any help is appreciated. I could not even come close to getting this to work. Thank you so much, I really would like to write this in BI/DAX as it is so much more powerful. I do have it working in excel , but its clunky and it seems to be unstable and breaks.

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Picture1.png

 

Payroll Batch CC =
VAR currentID = Expense[ID]
VAR paybatch_table_filter =
FILTER (
Paybatch,
Paybatch[ID] = currentID
&& Paybatch[Start Date] <= Expense[Expense date]
&& Paybatch[End Date] >= Expense[Expense date]
)
RETURN
SUMMARIZE ( paybatch_table_filter, Paybatch[Payroll batch] )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

thank you I will give this a shot.. this looks correct.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.

It is for creating a calculated column.

 

Picture1.png

 

Payroll Batch CC =
VAR currentID = Expense[ID]
VAR paybatch_table_filter =
FILTER (
Paybatch,
Paybatch[ID] = currentID
&& Paybatch[Start Date] <= Expense[Expense date]
&& Paybatch[End Date] >= Expense[Expense date]
)
RETURN
SUMMARIZE ( paybatch_table_filter, Paybatch[Payroll batch] )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.