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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors