Hi there! Iโm working on a less than/more than filter for a slice of data. It works to some extent but will return results outside of the parameters of the filter. My equations look like this:
AND(
IF(ISBLANK(ANY(Dashboard Filter[CalendarFilterBeforeDate])), true, ISNOTBLANK(SELECT([Related Calendar Events][Connected Case],DATETIME([Start])<=DATETIME(SELECT(Dashboard Filter[CalendarFilterBeforeDate],true)),true))),
IF(ISBLANK(ANY(Dashboard Filter[CalendarFilterAfterDate])), true, ISNOTBLANK(SELECT([Related Calendar Events][Connected Case],DATETIME([Start])>=DATETIME(SELECT(Dashboard Filter[CalendarFilterAfterDate],true)),true)))
)
What Iโm trying to do is return the entire slice if both the [CalendarFilterBeforeDate] and [CalendarFilterAfterDate] are blank. If one or both are not blank, then return the rows with related calendar events with [Start] datetime before or after values in the Dashboard Filter columns.
If I use the filters independently it appears to work fine. But if I put values in both the [CalendarFilterBeforeDate] and [CalendarFilterAfterDate], the Iโm returned slice values that arenโt between the two column values.
Any suggestions as to what Iโm doing wrong in my equations?
Thanks in advance!
Justin
Thereโs a lot to say here
ISBLANK(ANY(Dashboard Filter[CalendarFilterBeforeDate]))
Basically says choose any single row and see if this is column is blank. So you need to make sure that there is only 1 row in the Dashboard Filter table
Next you have:
DATETIME([Start])...
and
DATETIME(SELECT(...
Which implies these arenโt DATETIMEโs but your forcing them to be. Not sure why your not just using the date. Since I assume that Dashboard Filter[CalendarFilterBeforeDate] is a Date
Finally you have:
ISNOTBLANK(SELECT([Related...
In which your asking if a list is blank. This can sometimes give unusual results. Try this instead:
COUNT(SELECT([Related ...)=0
Hello @Wallace_Service, to add to what Simon said, thereโs also:
You could just remove the SELECT() since youโre returning all rows anyways.
I have attempted to simplify your expression with the following, please read the considerations I made afterwards:
IF(
AND(
ISBLANK(Dashboard Filter[CalendarFilterBeforeDate]),
ISBLANK(Dashboard Filter[CalendarFilterAfterDate])),
TRUE,
COUNT(
SELECT(
Dashboard Filter[Related Calendar Events][Connected Case],
AND(
[Start]<=[calendarRef].[CalendarFilterBeforeDate],
[Start]>=[calendarRef].[CalendarFilterAfterDate])
)=0)
)
CONSIDERATIONS
1- Since youโre checking for related calendar events, there must be a reference back to the parent table, replace [calendarRef]
with that columnโs name.
2- Using the <=
and >=
operators for comparing dates that might or might not be blank yields the correct logic result (Not sure if this actually happens)
3- The [Start]
, [CalendarFilterBeforeDate]
and [CalendarFilterBeforeDate]
columns are correctly configured as the same date setting.
Thanks @Rafael_ANEIC-PY and @1minManager!
I think weโre getting closer. One other consideration is that the Dashboard Filter is a slice of the โUsersโ table which filters the โCase Infoโ table. The [Start] column is part of the Google Calendar table. So, essentially Iโm using the dashboard filter to filter related Google Calendar entries to only show Case Info rows between certain calendar dates.
Does this make any difference to the equation above. I think the logic works but Iโm not sure if my references are correct. Iโm still getting some invalid filters errors.
Hi guys, thanks for the help so far. Iโve having a hard time getting this going still. Hereโs what I haveโฆ
IF(
AND(
ISBLANK(Dashboard Filter[CalendarFilterBeforeDate]),
ISBLANK(Dashboard Filter[CalendarFilterAfterDate])),
TRUE,
COUNT(
SELECT(
Case Info Database[Related Calendar Events][Connected Case],
AND(
[CalendarRef].[Start]<=[CalendarFilterRef].[CalendarFilterBeforeDate],
[CalendarRef].[Start]>=[CalendarFilterRef].[CalendarFilterAfterDate])
)=0)
)
There is something wrong with my SELECT statement. Iโm trying to return Case Info Database rows with Related Calendar events between the CalendarFilterBeforeDate and CalendarFilterAfterDate. [CalendarFilterBeforeDate] and [CalendarFilterAfterDate] are part of the Users tabel. The [Start] column is part of the Google Calendar table. The [CalendarRef] is a Ref column in the Case Info Database pointing to the Google Calendar table. The [CalendarFilterRef] column is a Ref column in the Case Info Database pointing to the Users table.
Iโm getting an invalid filter condition error when saving but I canโt see the issue as this statement is part of a bigger AND statement and the actually issue cuts off the error message.
Any ideas? Thanks in advance!
Try this:
ISNOTBLANK(
SELECT(
[Related Calendar Events][_ROWNUMBER],
AND(
ISNOTBLANK([Start]),
OR(
ISBLANK(Dashboard Filter[CalendarFilterAfterDate]),
(DATE([Start]) >= ANY(Dashboard Filter[CalendarFilterAfterDate]))
),
OR(
ISBLANK(Dashboard Filter[CalendarFilterBeforeDate]),
(DATE([Start]) <= ANY(Dashboard Filter[CalendarFilterBeforeDate]))
)
)
)
)
User | Count |
---|---|
37 | |
31 | |
28 | |
22 | |
18 |