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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

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])

 

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

 

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

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

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

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.