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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
syafeeq
New Member

COUNT in new column

I am new with PowerBI 

 

I would like to count the number of item_code and put it in a new colum. 

 

Screenshot 2024-05-10 at 09.27.36.png

 

so the new column will have

item_code 1 = 3

item_code x = 2

item_code y = 1

etc

How can i do that? 

 

thanks

2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

do you mean by year?

 

calculate(count(item),allexcept(table, year))

 

if you want distinct count ,try this

calculate(distinctcount(item),allexcept(table,year)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

I tried the following & it works for my need

CALCULATE(
COUNT(_TempTable[item_code]),
ALLEXCEPT(_TempTable,_TempTable[item_code])
)

thanks for the tip

View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

do you mean by year?

 

calculate(count(item),allexcept(table, year))

 

if you want distinct count ,try this

calculate(distinctcount(item),allexcept(table,year)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




I tried the following & it works for my need

CALCULATE(
COUNT(_TempTable[item_code]),
ALLEXCEPT(_TempTable,_TempTable[item_code])
)

thanks for the tip

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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