Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Gopinath_iyer
Helper II
Helper II

Calculated column

Hello Friends,

 

Can you help me with the below calculation, 

I want to create a new column "B" based on existing column "A".

 

AB
Desktop4
Desktop4
Desktop4
Desktop4
Laptop2
Laptop2
IPAD3
IPAD3
IPAD3
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Gopinath_iyer ,

 

It seems that you want to calculate the row count of each A and each Country, right?

Please try:

B = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[A],'Table'[Country]))

Eyelyn9_0-1649988984892.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Gopinath_iyer ,

 

It seems that you want to calculate the row count of each A and each Country, right?

Please try:

B = CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table','Table'[A],'Table'[Country]))

Eyelyn9_0-1649988984892.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

vojtechsima
Super User
Super User

Hi, @Gopinath_iyer 
Can you be more precise about what exactly you want?
Do you want just a duplicate of the A column? 
You can do that by just referencing the column in Calculated Column like this:

B = 'Table'[A]

I want to create column B with count of attributes in column A respectively.

E.g Column A has 4 rows with "Desktop" so column B should 4 and 

Column A has 2 rows for "Laptop" so B should be 2 and so on.

@Gopinath_iyer 
I see, makes sense.
Here you go:

vojtechsima_0-1649759750450.png

New B = 
var currentGrouop = 'Table'[A]
return COUNTROWS(FILTER('Table', 'Table'[A] = currentGrouop))

Thanks a lot its working...but it missed the country filter...can you suggest?.

 

ACountryB
DesktopUS3
DesktopUS3
DesktopUS3
DesktopUK1
LaptopUS1
LaptopUK1
IPADUK2
IPADUK2
IPADUS1

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors