Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I have one fact table (first image) and a dimension time including duration per shift (dag=day and avond=evening).
For each line in the fact table (first image) I want a calculated column that calculates whether the shift is day or evening (based on the shifts in the second image).
All help is greatly appreciated
Solved! Go to Solution.
Sorry, it's missing the VALUES( )
WhatShift =
CALCULATE (
VALUES(DimDate[Shift]),
FILTER (
DimDate,
DimDate[Datum] = FactTable[DatumTijd].[Date]
&& FactTable[DatumTijd] >= DimDate[StartTijd]
&& (
FactTable[DatumTijd] <= DimDate[EindTijd]
|| DimDate[EindTijd] = BLANK ()
)
)
)
Try this for your calculated column:
WhatShift =
CALCULATE (
DimDate[Shift],
FILTER (
DimDate,
DimDate[Datum] = FactTable[DatumTijd].[Date]
&& FactTable[DatumTijd] >= DimDate[StartTijd]
&& (
FactTable[DatumTijd] <= DimDate[EindTijd]
|| DimDate[EindTijd] = BLANK ()
)
)
)
I see that there's a blank for one of the [EindTijd] values. The code assumes that's equivalent to the end of the day.
Hi @AlB,
After calculate it's impossible to put DimDate[Shift], any idea how to resolve? Proper connections have been made in the data model so that's not hte issue
Sorry, it's missing the VALUES( )
WhatShift =
CALCULATE (
VALUES(DimDate[Shift]),
FILTER (
DimDate,
DimDate[Datum] = FactTable[DatumTijd].[Date]
&& FactTable[DatumTijd] >= DimDate[StartTijd]
&& (
FactTable[DatumTijd] <= DimDate[EindTijd]
|| DimDate[EindTijd] = BLANK ()
)
)
)
Hi @Luukvv93
You mean you want to take the Date/Time value in your first table in column 'DatumTijd' and check where that value falls in the second table, i.e. between what StartTijd and EindTijd and from there determine whether it is Avond or Dag?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!