Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts.
In a kpi I have tried to calculate the count of all ids that by each of types their last result is negative simultaneously.
So it looks like
Count(DISTINCT {<[ID] ={"=RangeMaxString([Last result of type1],[last result of type2], [last result of type3] = 'neg'"}>} [ID])
2 Q's
1) Is it a good way to calculate this?
2) Why does it go "-" if no year is selected? When I pick a year it gives back a number.
Many thanks in advance
Do ID values repeat across years?
-Rob
Hi @rwunderlich, no.
Can you post a screenshot of your data model?
-Rob
Hi @rwunderlich this is my model
The checkings table can be broken down to three groups of check IDs. Here I will only show for group1, table checkings1. This checkings1 table involves different types of checkings for this group of checks (field “type” of table checkings1).
checkings:
LOAD
"ID",
date(floor("checkdate"),'DD/MM/YYYY') as checkdate,
date("checkdate",'DD/MM/YYYY hh:mm:ss.ffffff') as “checkdate timestamp”,
"check ID"
FROM [$(vPathQVD)/checking.qvd]
(qvd);
LEFT JOIN(checkings)
LOAD
"Result ",
"Type",
"check ID1" as "check ID ",
“check ID1”
FROM [$(vPathQVD)/checkings1.qvd]
(qvd);
LEFT JOIN (checkings)
LOAD
"ID ",
“Type",
Date(Max( "checkdate")) AS [last checkdate of checkings1]
, max("check ID") as maxcheck1_id
RESIDENT
checkings
GROUP BY
"ID",
"Type"
;
For Each vType In FieldValueList('Type')
[$(vType) Checking1 Details]:
LOAD
"ID”,
maxckeck1_id as [ID of last checking1 type $(vType)],
[result] as [last result of checking1 type $(vType)]
RESIDENT
checkings
WHERE
"Type" = '$(vType)'
AND [check ID] = maxcheck1_id
;
Next vType
DROP FIELD [last checkdate of checkings1] FROM checkings;
And then I have a master calendar on field “checkdate”
What I want to see is the graph of the data model, available from the menu "Data Model Viewer".
Hi @rwunderlich , i am sorry for the delay, here is the data model
@rwunderlich , just noticed that yes, IDs repeat through years!
I think the best solution would be to assign a unique key for each row. You can do this in the script with
RecNo() as Key
and then use "Key" as your selector.
Count(DISTINCT {<[Key] ={"=RangeMaxString([Last result of type1],[last result of type2], [last result of type3] = 'neg'"}>} [ID])
-Rob