Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
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.
Solved! Go to Solution.
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.
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.
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.
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]))))
Hi @Stabben23 ,
look at this.
If I answered 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