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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
jkenne01
Frequent Visitor

Return Campaigns that fall between the Start and End Date from Date Slicer

Hi,

 

I have been googling all day but have not managed to find a working solution for this one. If anyone can help would be greatly appreciated.

 

I have a Date Slicer set to between where I can pick a Start Date and an End Date.

 

I have a Table which contains a dataset of Campaigns which all have a Start Date and an End Date.

 

I would like to return any Campaigns whose Start Date and End Date fall between the Start Date and End date on the slicer.

 

For example if I have chosen 2018-08-01->2018-08-31 as the Date range for the slicer and I have a Campaign that runs from 2018-07-20->2018-08-2018 then this record should be returned.

 

I have looked at the below post that that seems to work based on a single date being chosen - not a range.

 

https://community.powerbi.com/t5/Desktop/Use-date-slicer-to-check-if-date-falls-between-two-dates/td...

 

Thanks for your help.

 

 

 

 

2 ACCEPTED SOLUTIONS
TomMartens
Super User
Super User

Hey,

 

create a Calendar table (let's assume that this table is called daterange), that is not related to your campaigns table.

 

Create a measure in your campaigns table like so:

measurename = 
var startDaterange = MIN('daterange'[date])
var endDaterange = MAX('daterange'[date])
return
SUMX(
'campaign'
,
var startcampaign = 'campaign'[startdate]
var endcampaign = 'campaign'enddate]
return[
if(
AND(...
,1
,BLANK()
)


Create the proper condition that marks each campaign that falls into the selected daterange.

 

Now you can use this message in the "Visual levels filter" band to filter the campaigns.

 

Please consider to create a PBIX file that contains sample data, upload the pbix file to onedrive or dropbox and share the link.

 

Regards,

Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

Greg_Deckler
Super User
Super User

These two Quick Measures show how to do this:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @jkenne01,

 

Could you please mark the proper answers as solutions?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

These two Quick Measures show how to do this:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
TomMartens
Super User
Super User

Hey,

 

create a Calendar table (let's assume that this table is called daterange), that is not related to your campaigns table.

 

Create a measure in your campaigns table like so:

measurename = 
var startDaterange = MIN('daterange'[date])
var endDaterange = MAX('daterange'[date])
return
SUMX(
'campaign'
,
var startcampaign = 'campaign'[startdate]
var endcampaign = 'campaign'enddate]
return[
if(
AND(...
,1
,BLANK()
)


Create the proper condition that marks each campaign that falls into the selected daterange.

 

Now you can use this message in the "Visual levels filter" band to filter the campaigns.

 

Please consider to create a PBIX file that contains sample data, upload the pbix file to onedrive or dropbox and share the link.

 

Regards,

Tom

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors