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

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

Reply
Haidannx
Helper I
Helper I

create new column to distinct count the number of value in each rows

Hi,

I have a data set like below

Request IDProviderPrice
1HMS4$
1TMS7$
1TMS4$
1HMS11$
2TMS1$
2TMS2$
3HMS1$

 

I`d like to create a new column to distinct count "Provider" with the expected outcome like below:

Request IDProviderPriceCount
1HMS4$2
1TMS7$2
1TMS4$2
1HMS11$2
2TMS1$1
2TMS2$1
3HMS1$1

 

Please send help

With many thanks

1 ACCEPTED SOLUTION

Nevermind, i`ve found the DAX useful

# of provider = CALCULATE(DISTINCTCOUNT(table[Provider]),ALLEXCEPT(table,table[request_id]))
 
Thanks for all of your support

View solution in original post

8 REPLIES 8
amitchandak
Super User
Super User

Create a new column

new column = countx(filter(table,table[Request ID] =table[Request ID] && table[Provider] =table[Provider]),table[Request ID])

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

i don`t know why but the result comes out as Blank

It seems like my mistake. missing earlier

new column = countx(filter(table,table[Request ID] =earlier(table[Request ID]) && table[Provider] =earlier(table[Provider])),table[Request ID])

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Your DAX will tell me the how many rows are there with the same Request ID, not how many Provider does it have with the same Request id =((

can you check again your DAX?

the Provider columns`s  only 2 values whitch are HMS or TMS

 

Capture.PNG

Try

 

Column = CALCULATE(DISTINCTCOUNT(Sheet1[Provider]),FILTER(Sheet1,Sheet1[Request ID]=EARLIER(Sheet1[Request ID])))

 

link :https://www.dropbox.com/s/res6g1hr53edzpn/distinctCount.pbix?dl=0

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I have known this DAX
However, my dataset is to large (aroun 3 mils row) to use this DAX. It`d dumped RAM

Anonymous
Not applicable

Hi @Haidannx ,

Considering the large amount of data, and creating the calculated column will take up memory, you want to check if there is another method to achieve this requirement (like create one measure) ?

 

Best Regards

Rena

Nevermind, i`ve found the DAX useful

# of provider = CALCULATE(DISTINCTCOUNT(table[Provider]),ALLEXCEPT(table,table[request_id]))
 
Thanks for all of your support

Helpful resources

Announcements
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 Kudoed Authors