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
soji
Frequent Visitor

Using Loop in DAX

 

I am struck in one of the process to get the worked location of each employee for each date as i am not sure how to use Loop in DAX.

I have two tables as Worked location Table and Location Transfer Table as shown below and i want to get the worked location details in the worked location table from the Location Transfer Table as show in the 3rd table. Can you please help how to do it in PBI DAX. Thanks

Worked Location Table  
DateEmployee IDWorked Location
01-May-2312301 
02-May-2312301 
03-May-2312301 
04-May-2312301 
05-May-2312301 
06-May-2312301 
07-May-2312301 
08-May-2312301 
09-May-2312301 
10-May-2312301 

 

Location Transfer Table   
Employee IDWorked LocationFrom DateTo Date
12301MCC01-May-2303-May-23
12301DCC04-May-2308-May-23
12301IBN09-May-23 

 

Worked Location Table RESULT
DateEmployee IDWorked Location
01-May-2312301MCC
02-May-2312301MCC
03-May-2312301MCC
04-May-2312301DCC
05-May-2312301DCC
06-May-2312301DCC
07-May-2312301DCC
08-May-2312301DCC
09-May-2312301IBN
10-May-2312301IBN
1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

4 REPLIES 4
Ahmedx
Super User
Super User

pls try this

Sample PBIX file attached

https://1drv.ms/u/s!AiUZ0Ws7G26RiENbao3SlhO1c9yr?e=Dh3R9Y

Screen Capture #1196.png

Hi @Ahmedx 

Ihave 2 table in my Power BI report B-Details and SPResult. SP result table is a stored procedure and will change dynamically with parameters. I want to create a new table from this in which it should filter Name and Country from B-Details and SPResult. Now after filtering this we have a uniquekey in B-Details. Now in the new table for each UniqueKey we have to get all the filtered values from SPResult table. So in the new table UniqueKey key row will be duplicated with as much rows we have in SPResult. Can you help me how to fix this?

create a new topic, show what you want to get, because it is not clear what you need

soji
Frequent Visitor

Thank you very much Ahmed, It really worked.

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.