I'm having hard time trying to display the result of a virtual column as a single number. For example, I have a table such as this
Person | Fruit |
John | Orange |
Mary | Apple |
George | Apple |
Sally | Berry |
Bill | Orange |
I have a Virtual Field that calculates the number of instances of each fruit.
COUNT( SELECT( [Fruit] , [Fruit] = [_THISROW].[Fruit] ) )
This works perfectly fine. However, I can't find a way to display that result i a nice fashion. What I would like is a view that looks something like this:
Apple: 2
Berry: 1
Orange: 2
Is this possible?
Thanks.
Solved! Go to Solution.
Yeah, that’s totally doable, but not with a regular table view out of the box. Here’s what I’ve done in a similar case:
1. Create a new table (let’s call it Fruit Summary) with just one column: Fruit.
2. Add a virtual column in that table, something like:
COUNT(SELECT(OriginalTable[Fruit], [Fruit] = [_THISROW].[Fruit]))
3. Then use a Deck View or Card View on Fruit Summary, that gives you the clean layout you’re looking for, like:
Apple – 2
Orange – 2
Berry – 1
You can even tweak it with formatting rules if you want to color-code the counts or fruit types. I’ve used this pattern to show tag usage and status breakdowns, works great when you want a quick summary without hacking slices or reports.
Yeah, that’s totally doable, but not with a regular table view out of the box. Here’s what I’ve done in a similar case:
1. Create a new table (let’s call it Fruit Summary) with just one column: Fruit.
2. Add a virtual column in that table, something like:
COUNT(SELECT(OriginalTable[Fruit], [Fruit] = [_THISROW].[Fruit]))
3. Then use a Deck View or Card View on Fruit Summary, that gives you the clean layout you’re looking for, like:
Apple – 2
Orange – 2
Berry – 1
You can even tweak it with formatting rules if you want to color-code the counts or fruit types. I’ve used this pattern to show tag usage and status breakdowns, works great when you want a quick summary without hacking slices or reports.
Thanks, that works!
Hello try use this in yout virtual field
[Fruit] & ": " & COUNT(SELECT(Persons[Fruit], [Fruit] = [_THISROW].[Fruit]))
This works for each record, But if you want all the fruits summarized, then apply the solution of @Homer-Ross
Regards
User | Count |
---|---|
18 | |
11 | |
7 | |
4 | |
3 |