cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
LearningBI1986
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
Greg_Deckler
Super User
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

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
LearningBI1986
Frequent Visitor

@Greg_Deckler thank you!

Greg_Deckler
Super User
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

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

@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 🤔Screenshot 2023-05-02 133517.png

 

@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!!

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors