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!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi folks,
Looking for a bit of help in adding a Custom Column to define if a date is between two sets of date ranges i.e. If [Date] Between [Valid Start 1] and [Valid End 1] then Valid else If [Date] [Valid Start 2] and [Valid End 2] then "Valid" else "Invalid".
[Valid Start/End 2] may contain null values where it is not present in the dataset.
Sample Table:
| Date | Valid Start 1 | Valid End 1 | Valid Start 2 | Valid End 2 | Valid? |
| 01/06/2022 | 01/01/2021 | null | null | null | Valid |
| 01/06/2022 | 01/01/2021 | 01/12/2022 | null | null | Valid |
| 01/06/2022 | 01/01/2021 | 01/01/2022 | null | null | Invalid |
| 01/06/2022 | 01/01/2021 | 31/12/2021 | 01/04/2022 | null | Valid |
| 01/06/2022 | 01/01/2021 | 01/01/2022 | 01/04/2022 | 01/07/2022 | Valid |
| 01/06/2022 | 01/01/2021 | 01/01/2022 | 01/04/2022 | 01/05/2022 | Invalid |
The Valid Start / End dates are actually stored in a different table and have been appended by merging tables - if its easier to "lookup" without the merge no problem going down that route.
Any help very welcome.
Steve
Solved! Go to Solution.
@StevenMorgan81 Add a custom column like:
= if ( [Date] >= [Valid Start 1] and ( [Valid End 1] = null or [Date] <= [Valid End 1]) and not([Valid Start 1] = null and [Valid End 1] = null ) ) or ( [Date] >= [Valid Start 2] and ( [Valid End 2] = null or [Date] <= [Valid End 2]) and not([Valid Start 2] = null and [Valid End 2] = null ) ) then "Valid" else "Invalid"
@StevenMorgan81 Add a custom column like:
= if ( [Date] >= [Valid Start 1] and ( [Valid End 1] = null or [Date] <= [Valid End 1]) and not([Valid Start 1] = null and [Valid End 1] = null ) ) or ( [Date] >= [Valid Start 2] and ( [Valid End 2] = null or [Date] <= [Valid End 2]) and not([Valid Start 2] = null and [Valid End 2] = null ) ) then "Valid" else "Invalid"
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.