Forum Discussion
aflip
3 years agoFrequent Visitor
FILTER function resulting in error - HELP
I have a dataset consisting of lease numbers, accrual periods, production dates, and volumes by product. I'm trying to do a simple FILTER() function as a measure, but am getting this error: "The expr...
- 3 years ago
change your date to
date(2023,01,01)
bsheffer
3 years agoContinued Contributor
you are creating a table, not a measure so you can't use selectedvalue as that will always return a blank if there is more than one date. This table will be re-created when you refresh your data so it is not dynamic like a measure is.
I think you need to better describe what you are trying to accomplish
- aflip3 years agoFrequent Visitor
bsheffer Here is the bigger picture: I'm trying to compare between two accrual period dates dynamically to see if it exists in the current accrual period(for example, 01/01/2023), but not in the previous accrual period(12/01/2022), but having a slicer vertical list for Accrual_Period_Date so you can select your "current accrual period date".
This is what I tried:
NewPayments =VAR _Table1 = SELECTCOLUMNS(FILTER('Sheet1',SELECTEDVALUE(Sheet1[Accrual_Period_Date])),"LEASE",[LEASE],"Accrual_Period_Date",[Accrual_Period_Date],"Date",[Date],"Product",[Product],"NetVolume",[Net Prorated Volume, BOE])VAR _Table2 = SELECTCOLUMNS(FILTER('Sheet1',DATEADD(FILTER(LASTDATE('Sheet1'[Accrual_Period_Date]), 'Sheet1'[Accrual_Period_Date] = SELECTEDVALUE(Sheet1[Accrual_Period_Date])), -1, MONTH)),"LEASE",[LEASE],"Accrual_Period_Date",[Accrual_Period_Date],"Date",[Date],"Product",[Product],"NetVolume",[Net Prorated Volume, BOE])RETURNEXCEPT(_Table1,_Table2)