cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## Counting multiple values in a single column

Hi there

I am learning BI. Right now, for simplistic reasons, I have a column of postal codes. I would like to count how many postal codes begin with "A," how many begin with "B," how many begin with "C," and so on.

I would like to be able to place this on a map, where the bubble size on the map indicates the number of "A's," the number of "B's," etc.

Any help would be much appreciated 🙂

1 ACCEPTED SOLUTION
Super User

@LearningBI1986 Perhaps create a DAX measure like this?

``````Bubble Size Measure =
VAR __PC = MAX('Table'[PostalCode])
VAR __FirstChar = LEFT(__PC, 1)
VAR __Table = FILTER(ALL('Table'), LEFT([PostalCode], 1) = __FirstChar)
VAR __Result = COUNTROWS(__Table)
RETURN
__Result``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
5 REPLIES 5
Frequent Visitor

@Greg_Deckler thank you!

Super User

@LearningBI1986 Perhaps create a DAX measure like this?

``````Bubble Size Measure =
VAR __PC = MAX('Table'[PostalCode])
VAR __FirstChar = LEFT(__PC, 1)
VAR __Table = FILTER(ALL('Table'), LEFT([PostalCode], 1) = __FirstChar)
VAR __Result = COUNTROWS(__Table)
RETURN
__Result``````

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

@Greg_Deckler

Thank you for getting back! That looks promising.
If you don't mind, I'm going to attempt to paste a screenshot here. If you could tell me what I'm doing wrong, I would really appreciate it 🤔

Super User

@LearningBI1986 you put in __Merge2 but __Merge2  variable not you create see agian your code you create __Table Variable.
VAR  __Result = COUNTROWS(__Table)

THANK YOU!!

Super User

@LearningBI1986 Where that red underline is, that needs to be __Table, not __Merge2.

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

#### Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

#### Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors