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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
wes-shen-poal
Helper III
Helper III

Add a calculated column that count number of rows based on an existing column

Hi there,

 

I am very new to DAX, and I'm assuming this would be a very easy DAX formula that I just don't know.

I want to add a calculated column (highlight yellow) which gives me the count of VehicleIDs (or rows) based on the Ship Voyage column

 

Capture.PNG

 

 

Can someone kindly assist?

 

Thanks in advance.

Wes

 

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @wes-shen-poal,

 

You can create a calculated column like this:

Vehicles Onboard = CALCULATE(COUNTROWS('Table1'),FILTER('Table1','Table1'[Ship Voyage]=EARLIER(Table1[Ship Voyage])))

 

Or you can create a measure like below:

Measure = CALCULATE(COUNTROWS('Table1'),FILTER(ALL('Table1'),'Table1'[Ship Voyage]=MAX('Table1'[Ship Voyage])))

 

q1.PNG

 

You can download attached pbix file to have a look.

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
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

3 REPLIES 3
Anonymous
Not applicable

Hi there,
We hope you can help us.! 😄 

Is it possible to make a formula where the first number of two will be changed to “1” and the second one to “0” based on characteristics seen in the first row.
Example: 
"if customer name or category or customer number is mentioned several times?"

 

We have tried to create a formula. but we have not solved the problem yet, hope you understand the problem. 

Calculated column =CALCULATE(COUNT(Append1[category]);ALLEXCEPT(Append1;Append1[category];Append1[customer number];Append1[dateyear]))  

Customer numberCustomer nameCustomer CategoryCategoryDateyearCalculated Column 1
1273Peter Hansen1253568942PersonbogCPR20191
1331Anne Jensen123456789PersonbogCPR20192
1331Anne Jensen123456789PersonbogCPR20192
1349Poul West15423697PersonbogCPR20191

 

 

v-qiuyu-msft
Community Support
Community Support

Hi @wes-shen-poal,

 

You can create a calculated column like this:

Vehicles Onboard = CALCULATE(COUNTROWS('Table1'),FILTER('Table1','Table1'[Ship Voyage]=EARLIER(Table1[Ship Voyage])))

 

Or you can create a measure like below:

Measure = CALCULATE(COUNTROWS('Table1'),FILTER(ALL('Table1'),'Table1'[Ship Voyage]=MAX('Table1'[Ship Voyage])))

 

q1.PNG

 

You can download attached pbix file to have a look.

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-qiuyu-msft

 

Thank you so much for your help.

 

Wes

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors