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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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