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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
HarryHKE
Frequent Visitor

How can i count unique text in rows which occur more than 1 time

Hello,

 

I have a question and i seems to figure this one out, in my database i have two rows. 1 is a Stamordernumber row and the other a ordernumber row when there is a project which has no additional cost the stamorder row and the ordernumber row have the same number. However when i make a addional order which is link to the Stamorder number the stamorder number will stay the same and the ordernumber will change. See below axample.

 

Stamorder number   -   Ordernumber

SO32100060                  SO32200060   (This is a order with no additional cost on is, so this is the main and only order)

SO32100105                  SO32200105   (This is a order with additional cost on is, so this is the main order)

SO32100105                  SO32200106   (and this is the additonal order with the addition cost on it)

 

Now i would lik to have a colum count in front of the stamorder number which counts the amount of rows which has the same stamorder number, see below example.

 

Count    -   Stamorder number   -   Ordernumber

1                SO32100060                  SO32200060   (This is a order with no additional cost on is, so this is the main and only order)

2                SO32100105                  SO32200105   (This is a order with additional cost on is, so this is the main order)

2                SO32100105                  SO32200106   (and this is the additonal order with the addition cost on it)

 

I tried everthing with CALCULATE and DISTINCTCOUNT but i just don't seem to get a correct count, could anyone help me please.

 

The table with the stamordernumber in it is a text table.

 

See also below a sample of the databse, 

HarryHKE_0-1660134446701.png

 

 

Thank You,

Harry

 

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

Hi @HarryHKE ,

 

From what I am understanding, you want to count group by Stamorder number.

Please try this calculated column. 

Count = CALCULATE(COUNT('Table'[Stamorder number]),ALLEXCEPT('Table','Table'[Stamorder number]))

vstephenmsft_0-1660628015390.png

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
HarryHKE
Frequent Visitor

Tank you !!

v-stephen-msft
Community Support
Community Support

Hi @HarryHKE ,

 

From what I am understanding, you want to count group by Stamorder number.

Please try this calculated column. 

Count = CALCULATE(COUNT('Table'[Stamorder number]),ALLEXCEPT('Table','Table'[Stamorder number]))

vstephenmsft_0-1660628015390.png

 

 

Best Regards,

Stephen Tao

 

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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