I need to do a conditional count on a number of assessments. It needs to be a distinct count over person and date. My raw data looks something like this:
Name [tab]Date [tab]Assessment Type [tab]Assessment Time
Chuck Smith [tab]6/7/2010 [tab]1 [tab]6/7/10 1:00
Chuck Smith [tab]6/7/2010 [tab]2 [tab]6/7/10 1:00
Chuck Smith [tab]6/7/2010 [tab]3 [tab]6/7/10 1:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 1:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 2:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 3:00
Chuck Smith [tab]6/8/2010 [tab]2 [tab]6/8/10 1:00
Chuck Smith [tab]6/8/2010 [tab]2 [tab]6/8/10 2:00
Chuck Smith [tab]6/9/2010 [tab]2 [tab]6/9/10 3:00
Chuck Smith [tab]6/9/2010 [tab]3 [tab]6/9/10 14:00
Larry Jones [tab]6/7/2010 [tab]1 [tab]6/7/10 1:00
Larry Jones [tab]6/7/2010 [tab]2 [tab]6/7/10 1:00
Larry Jones [tab]6/8/2010 [tab]1 [tab]6/8/10 1:00
Larry Jones [tab]6/8/2010 [tab]1 [tab]6/8/10 2:00
Larry Jones [tab]6/8/2010 [tab]2 [tab]6/8/10 1:00
Larry Jones [tab]6/9/2010 [tab]1 [tab]6/9/10 1:00
Larry Jones [tab]6/9/2010 [tab]1 [tab]6/9/10 2:00
Larry Jones [tab]6/9/2010 [tab]2 [tab]6/9/10 1:00
Larry Jones [tab]6/9/2010 [tab]2 [tab]6/9/10 2:00
Larry Jones [tab]6/10/2010[tab]1 [tab]6/10/10 1:00
Larry Jones [tab]6/11/2010[tab]2 [tab]6/11/10 1:00
The result set should look something like the following:
Name [tab]Assessment Type 1 [tab]Assessment Type 2 [tab]Assessment Type 3
Chuck Smith [tab]2 [tab]3 [tab]2
Larry Jones [tab]4 [tab]4 [tab]0
If it didn't need to be a distinct count I could just use sum with a case statement, but this won't be distinct. I would like to use OLAP aggregates because I still need to bring back the detail data.
Thanks,
Kevin
Name [tab]Date [tab]Assessment Type [tab]Assessment Time
Chuck Smith [tab]6/7/2010 [tab]1 [tab]6/7/10 1:00
Chuck Smith [tab]6/7/2010 [tab]2 [tab]6/7/10 1:00
Chuck Smith [tab]6/7/2010 [tab]3 [tab]6/7/10 1:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 1:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 2:00
Chuck Smith [tab]6/8/2010 [tab]1 [tab]6/8/10 3:00
Chuck Smith [tab]6/8/2010 [tab]2 [tab]6/8/10 1:00
Chuck Smith [tab]6/8/2010 [tab]2 [tab]6/8/10 2:00
Chuck Smith [tab]6/9/2010 [tab]2 [tab]6/9/10 3:00
Chuck Smith [tab]6/9/2010 [tab]3 [tab]6/9/10 14:00
Larry Jones [tab]6/7/2010 [tab]1 [tab]6/7/10 1:00
Larry Jones [tab]6/7/2010 [tab]2 [tab]6/7/10 1:00
Larry Jones [tab]6/8/2010 [tab]1 [tab]6/8/10 1:00
Larry Jones [tab]6/8/2010 [tab]1 [tab]6/8/10 2:00
Larry Jones [tab]6/8/2010 [tab]2 [tab]6/8/10 1:00
Larry Jones [tab]6/9/2010 [tab]1 [tab]6/9/10 1:00
Larry Jones [tab]6/9/2010 [tab]1 [tab]6/9/10 2:00
Larry Jones [tab]6/9/2010 [tab]2 [tab]6/9/10 1:00
Larry Jones [tab]6/9/2010 [tab]2 [tab]6/9/10 2:00
Larry Jones [tab]6/10/2010[tab]1 [tab]6/10/10 1:00
Larry Jones [tab]6/11/2010[tab]2 [tab]6/11/10 1:00
The result set should look something like the following:
Name [tab]Assessment Type 1 [tab]Assessment Type 2 [tab]Assessment Type 3
Chuck Smith [tab]2 [tab]3 [tab]2
Larry Jones [tab]4 [tab]4 [tab]0
If it didn't need to be a distinct count I could just use sum with a case statement, but this won't be distinct. I would like to use OLAP aggregates because I still need to bring back the detail data.
Thanks,
Kevin