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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
KFH_2023
New Member

Date Slicer to Include/Exclude Data for End User

Objective: End User selects a Start Date and End Date in a slicer. It can be a range or drop down options. From there certain items are included or excluded based on criteria. 

Issue: The slicer value for start date and end date are not working with the calcuation for inclusion. Any thoughts/suggestions for getting the inclusion flag to work?

Criteria: 

1st set of criteria: If the Expenditure Date is before the End Date AND the Creation Date BETWEEN start/end dates

OR 

2nd set of criteria: If the Creation Date is NOT BETWEEN start/end dates but the Creation Date is before the start date AND the Expenditure Date is BETWEEN the start/end dates 

Include else Exclude

 

The Inclusion Flag as written in Power BI: 

Inclusion Flag = if(('Dummy Table'[Item Date]<=[End Date] && ('Dummy Table'[Creation Date]>=[Start Date] && 'Dummy Table'[Creation Date]<=[End Date]))||((('Dummy Table'[Creation Date]<[Start Date]||'Dummy Table'[Creation Date]>[End Date]) && 'Dummy Table'[Creation Date]<=[Start Date])&&('Dummy Table'[Item Date]>=[Start Date]&&'Dummy Table'[Item Date]<=[End Date])),"Include","Exclude")
KFH_2023_0-1684267843876.png

 

2 REPLIES 2
KFH_2023
New Member

The Date data is on a separate table from the values. I don't see an option to upload my pbix here, otherwise I'd share it with you so you could see. 

amitchandak
Super User
Super User

@KFH_2023 , Slicer need to be on an independent table

 

//Date1 is independent Date table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = minx(allselected(Date1),Date1[Date])
return
calculate( sum(Table[Value]), filter('Table', (  'Table'[Expenditure  Date] >=_min && 'Table'[Expenditure  Date] <=_max) ||  (  'Table'[Creation Date] >=_min && 'Table'[Creation Date] <=_max)) )

 

something not in these ranges

Not selected in range =

Countx(Values(Table[Item]), if(isblank([new measure]) , [Item], blank() ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors