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.
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:
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.
@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() ) )