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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Stabben23
Helper I
Helper I

Add shift to fact table

Hi guys,

 

I want to add shift to my fact table, I have a dimension with start and end timestamp and a fact with timestamp.

Now I want to map the shift field into facttable. 

All solutions is OK, connections between tables or dax formulas. What I want to achieve is that I can use shift with visualizations.

My Timestamp in fact is connected to a calendartable. Expected is my mapped field.

shift.PNG

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In Table1, write this calculated column formula

=LOOKUPVALUE(Table2[Shift],Table2[DateStart],CALCULATE(MIN(Table2[Datastart]),FILTER(Table2,Table2[DateStart]<=EARLIER(Table1[TimeStamp])&&Table2[DateEnd]>=EARLIER(Table1[TimeStamp]))))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

4 REPLIES 4
Stabben23
Helper I
Helper I

Thanks to all,

Great to see how other solve this common issue in Power BI.

I like the lookupvalue solution best and this was pretty near what I have play around with.

Ashish_Mathur
Super User
Super User

Hi,

In Table1, write this calculated column formula

=LOOKUPVALUE(Table2[Shift],Table2[DateStart],CALCULATE(MIN(Table2[Datastart]),FILTER(Table2,Table2[DateStart]<=EARLIER(Table1[TimeStamp])&&Table2[DateEnd]>=EARLIER(Table1[TimeStamp]))))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
az38
Community Champion
Community Champion

Hi @Stabben23 

 

Try new measure to the FactTable

Expected = CALCULATE(max(dimTable[Shift]);filter(all(dimTable);and(dimTable[DateStart]<=SELECTEDVALUE(FactTable[TimeStamp]);dimTable[DateEnd]>SELECTEDVALUE(FactTable[TimeStamp]))))
 

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Stabben23 ,

 

look at this.

https://community.powerbi.com/t5/Desktop/Join-with-greater-than-AND-less-than-to-join-date-time-tabl...

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
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.

Top Solution Authors
Top Kudoed Authors