Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have 2 date fields (DtPrimaryCareMgAssign) and (DtEnrlNotif). DtEnrlNotif may have 'NONE' listed as one of the variables which I do NOT want to count. I also have a field named [tabnm] and I only need 'new' returned. The [countall] field is a catchall field that has a 1 in every line so I can do count(countall) on different items.
I want to know the count for all who had a date in DtPrimaryCareMgAssign who's date came after the date listed in DtEnrlNotif.
This is what I have so far and I am getting zero.
count({<[DtPrimaryCareMgAssign]={'>=$[DtEnrlNotif]'},tabnm={'new'},$DtEnrlNotif-={"NONE"}>}[countall])
I suggest you simply create a new field in your script
,if(DtPrimaryCareMgAssign]>=[DtEnrlNotif],'After','Before') as flagfield
and use this flagfield in set analysis like below
count({<[flagfield ]={'After'},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
the way to do it in front end would be as below, this will cause performance issues
count({<[Keyfield]={"=DtPrimaryCareMgAssign>=[DtEnrlNotif]"},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
or
count({<[DtPrimaryCareMgAssign]={"=DtPrimaryCareMgAssign>=[DtEnrlNotif]"},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
OR
count({<tabnm={'new'},DtEnrlNotif-={"NONE"}>} if(DtPrimaryCareMgAssign>=DtEnrlNotif ,[countall]))
correction, should be double quotes
I suggest you simply create a new field in your script
,if(DtPrimaryCareMgAssign]>=[DtEnrlNotif],'After','Before') as flagfield
and use this flagfield in set analysis like below
count({<[flagfield ]={'After'},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
the way to do it in front end would be as below, this will cause performance issues
count({<[Keyfield]={"=DtPrimaryCareMgAssign>=[DtEnrlNotif]"},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
or
count({<[DtPrimaryCareMgAssign]={"=DtPrimaryCareMgAssign>=[DtEnrlNotif]"},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
OR
count({<tabnm={'new'},DtEnrlNotif-={"NONE"}>} if(DtPrimaryCareMgAssign>=DtEnrlNotif ,[countall]))
correction, should be double quotes
I am getting different counts. It returns 1028 but I believe it should be 801. Should it be distinct?
since the countall field is 1; count distinct of countall will always return 1 or 2 if countall has 1s and 0's
have you tried creating a flag field in script?
I would happily do that if I knew how. Countall is always 1 by the way, never anything else. Can you please provide the flag script you are talking about? I am learning this piece by piece. Thanks.
I'm doing this as either a table or a KPI and the below returns an error for both in the Expression builder area. What am I doing wrong?
,if(DtPrimaryCareMgAssign]>=[DtEnrlNotif],'After','Before') as flagfield
count({<[flagfield ]={'After'},tabnm={'new'},DtEnrlNotif-={"NONE"}>}[countall])
You have to create a field in the load script so that it exists in your data model
Thanks, this helped!