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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
STEVE_WT
Frequent Visitor

Custom column to filter a date table dynamically

Hi

 

I have a list of campaign which a user will choose from a drop down slicer. Each of these campaigns has a start and end date. 

I also have a standalone calendar table with a list of dates. I need this to be filtered based on what the start and end date are of the the chose campaign.

This standalone date tabel will then be attached a table of transactions. 

See below.

Campaign dropdown is in the top left and the start and end date for that below. These will change with each campaign chosen.

The date list is on the right.

 

I need help with how to create a measure to dynamically filter the date list.

 

STEVE_WT_0-1732197856953.png

 

1 ACCEPTED SOLUTION

This worked perfectly. It was causing a lot of stress! Thanks very much for helping.

 

STEVE_WT_0-1732287087464.png

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @STEVE_WT ,

 

You can create a measure.

FilteredDates =
VAR SelectedCampaign = SELECTEDVALUE(Campaign[CampaignName])
VAR StartDate = CALCULATE(MIN(Campaign[StartDate]), Campaign[CampaignName] = SelectedCampaign)
VAR EndDate = CALCULATE(MAX(Campaign[EndDate]), Campaign[CampaignName] = SelectedCampaign)
RETURN
IF(MAX(Calendar[Date]) >= StartDate && MAX(Calendar[Date]) <= EndDate,1)

 

Then drag it to the date table visual filter to filter data with a value of 1.

vkaiyuemsft_0-1732241538943.png

vkaiyuemsft_1-1732241545508.png

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.

 

This worked perfectly. It was causing a lot of stress! Thanks very much for helping.

 

STEVE_WT_0-1732287087464.png

 

johnt75
Super User
Super User

I'd create a calculation group with a calculation item like

Calc item =
IF (
    HASONEVALUE ( 'Table'[campaign name] ),
    CALCULATE (
        SELECTEDMEASURE (),
        DATESBETWEEN (
            'Date'[Date],
            SELECTEDVALUE ( 'Table'[start date] ),
            SELECTEDVALUE ( 'Table'[end date] )
        )
    ),
    SELECTEDMEASURE ()
)

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors