Forum Discussion
ReadTheIron
4 years agoHelper III
Filtering a table on multiple criteria
I have two related tables, AssetTable and IncidentTable. I am trying to get a count of entries in FailureTable that satisfy multiple criteria. Specifically, I want to create a calculated column to co...
- 4 years ago
Hi,
This calculated column formula will work
=coalesce(CALCULATE(COUNTROWS(Incident),FILTER(Incident,Incident[Asset]=EARLIER(Asset[Asset])&&Incident[IncidentDate]>EARLIER(Asset[RepairDate])&&Incident[Cause]<>"snow")),0)Hope this helps.
Ashish_Mathur
4 years agoSuper User
Hi,
This calculated column formula will work
=coalesce(CALCULATE(COUNTROWS(Incident),FILTER(Incident,Incident[Asset]=EARLIER(Asset[Asset])&&Incident[IncidentDate]>EARLIER(Asset[RepairDate])&&Incident[Cause]<>"snow")),0)
Hope this helps.
- ReadTheIron4 years agoHelper III
Thank you! This worked beautifully!
- Ashish_Mathur4 years agoSuper User
You are welcome.
- ReadTheIron4 years agoHelper III
I'm writing this column for other asset tables, which I believe are formatted exactly the same way, but I'm getting "The first argument of EARLIER/EARLIEST is not a valid column reference in the earlier row context". I can't figure out why it would work on one and not the other. Any thoughts?
- ReadTheIron4 years agoHelper III
Never mind, found my error - the AssetRepairDate being referred to was a measure not a column. Changed it from a measure to a calculated column and now everything is working.