The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello,
I have a table with 2 date fields; one is "Contract Start Date" and the other is "Contract End Date". I have created a filter for "Contract Start Date" with criteria is on or before "DATE"; and another filter for "Contract End Date" with criteria is on or after "DATE".
Example:
The problem is I need to select the date twice everytime I change the date. Is there any way I can get one filter/slicer that filters my selection two different date columns (with different criteria - "Contract Start Date" is on or before "DATE"; "Contract End Date" is on or after "DATE") from the same table?
Solved! Go to Solution.
If you create a seperate date dimension table disconnected from the other tables in your model you can use that in your slicer to select a date or date range. Then you can create a measure to filter the report based on the selected date. E.g. something like
Date Filter =
VAR MinDate = MIN('Date Dim'[Date])
VAR MaxDate = MAX('Date Dim'[Date])
VAR ContractStart = SELECTEDVALUE('Contract Table'[Contract Start])
VAR ContractEnd = SELECTEDVALUE('Contract Table'[Contract End])
RETURN
ContractStart <= MaxDate &&
ContractEnd >= MinDate
Which should return TRUE if the date criteria are met.
If you create a seperate date dimension table disconnected from the other tables in your model you can use that in your slicer to select a date or date range. Then you can create a measure to filter the report based on the selected date. E.g. something like
Date Filter =
VAR MinDate = MIN('Date Dim'[Date])
VAR MaxDate = MAX('Date Dim'[Date])
VAR ContractStart = SELECTEDVALUE('Contract Table'[Contract Start])
VAR ContractEnd = SELECTEDVALUE('Contract Table'[Contract End])
RETURN
ContractStart <= MaxDate &&
ContractEnd >= MinDate
Which should return TRUE if the date criteria are met.