Forum Discussion
Card visual for the top performer
I have data which is roughly as follows:
| Date | Name | Call Time (Hours) |
| 11/09/20 | Person 1 | 2.34 |
| 11/09/20 | Person 2 | 1.56 |
| 11/09/20 | Person 3 | 4.67 |
| 10/09/20 | Person 1 | 3.45 |
| 10/09/20 | Person 2 | 1.56 |
| 10/09/20 | Person 3 | 2.35 |
| etc | etc | etc |
And I'm looking to create a card visual to show the person who has the highest call time each week. I already have a page filter to show only the last week, which I assume will also apply to any calculations I add to a visual.
How would I go about creating a calculation that can do this?
- Anonymous6 years ago
Hi morgancampbell,
You can try to use the following calculated table formula to summarize your raw table records based on the year and week group.
Then it will output the top users based on total call hours and year week group:TC by Year & Week = VAR summary = SUMMARIZE ( ADDCOLUMNS ( T2, "Weeknum", WEEKNUM ( [Date], 1 ), "Year", YEAR ( [Date] ) ), [Name], [Year], [Weeknum], "TC", SUM ( T2[Call Time (Hours)] ) ) RETURN ADDCOLUMNS ( GROUPBY ( summary, [Year], [Weeknum], "MaxTC", MAXX ( CURRENTGROUP (), [TC] ) ), "Name", MAXX ( FILTER ( summary, [TC] = EARLIER ( [MaxTC] ) && [Year] = EARLIER ( [Year] ) && [Weeknum] = EARLIER ( [Weeknum] ) ), [Name] ) )
Regards,Xiaoxin Sheng
2 Replies
- jthomson
Solution Sage
I thought there was a TOPN type of filter built in which you could use for this sort of thing?
- AnonymousNot applicable
Hi morgancampbell,
You can try to use the following calculated table formula to summarize your raw table records based on the year and week group.
Then it will output the top users based on total call hours and year week group:TC by Year & Week = VAR summary = SUMMARIZE ( ADDCOLUMNS ( T2, "Weeknum", WEEKNUM ( [Date], 1 ), "Year", YEAR ( [Date] ) ), [Name], [Year], [Weeknum], "TC", SUM ( T2[Call Time (Hours)] ) ) RETURN ADDCOLUMNS ( GROUPBY ( summary, [Year], [Weeknum], "MaxTC", MAXX ( CURRENTGROUP (), [TC] ) ), "Name", MAXX ( FILTER ( summary, [TC] = EARLIER ( [MaxTC] ) && [Year] = EARLIER ( [Year] ) && [Weeknum] = EARLIER ( [Weeknum] ) ), [Name] ) )
Regards,Xiaoxin Sheng