简体   繁体   中英

spotfire multiple over statements in one custom expression

I have a table of travel expenses for analysis.

I would like to create a calculated column with a value for the maximum count of records with a certain category for each employee on any given day.

For example, if the category being reviewed is "dinner", we would like to know what is the maximum number of dinner transactions charged on any given day.

The following custom expression was able to count how many dinner expenses per employee:

count(If([Expense Type]="Dinner",[Expense Type],null)) over ([Employee])

But when trying to get the max count over days, I cant seem to get it to work. Here is the expression used:

Max(count(If([Expense Type]="Dinner",[Expense Type],null)) over ([Employee])) over (Intersect([Employee],[Transaction Date]))

This seems to provide the same answer as the first expression. Any idea on how to get this code to identify the value on the date with the most expenses for each employee?

If i understand your question and comments correctly, you should be able to use intersect.

count(If([Expense Type]="Dinner",[Expense Type],null)) over (Intersect([Transaction Date],[Employee]))

You may need to cast [Transaction Date] as a date if it is an actual DateTime. Otherwise you'd get one for each unique DT.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM