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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Count how many times my reference number appears on a row

Hi there,

 

I am looking for help/ solution to display how many times each booking reference appears in my POWERBI query/ table. I want the function to count how many times the booking reference appear in the query and put the number of appearance against each row  (as shown below) so that I can track them and cross check that they are working. 

Is this possible ? Please help. 

 

Capture.JPGCapture2.JPG

8 REPLIES 8
Anonymous
Not applicable

Hey @Anonymous 

Use the following DAX

Count =
COUNTROWS (
    FILTER ( Table, Table[Booking_Reference] = EARLIER ( [Booking_Reference] ) )
)

Good Luck!

Anonymous
Not applicable

OMG! Thank you so so so much ! 

 

I was wondering if you can help me with one more enquiry. Is there a formula where we can count each time the booking reference occured as shown below. We are planning to use the count number 1 for further calculations.  Please help. 

 

 Capture3.JPG

Anonymous
Not applicable


I was wondering if you can help me with one more enquiry. Is there a formula where we can count each time the booking reference occured as shown below. We are planning to use the count number 1 for further calculations.  Please help. 

 

 Capture3.JPG


Hey @Anonymous 

Here you go. A step-by-step tutorial to achieve what you want.

Good Luck!
A

Anonymous
Not applicable

Hi mate, 

 

Thanks again. 

 

This did not work for us. I think we got stuck with the DAX during the measure. Would you mind suggesting another solution? The DAX is not picking up the correct fields we were after. 

 

We created the Index Column from the Query; then we went to actual table and created a Calculated column using a measure. While we were trying to define the measure, we were not successful. 

Anonymous
Not applicable

@Anonymous 

Please share a sample of your data and/or your PBIX file.

Thanks,
A

Hi,

Will you be OK with a solution in the M language?  Also, instead of xx, shouldn't the answer be 1?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish,

 

thanks for your email. Do you mean Measure by M language? 

 

Yes - XX should be 1. I just wanted to emphasize the the first booking reference.

 

Thanks, 

 

ARIF 

Hi,

"M" (short for Mashup) is the coding language of the Query Editor whereas measures are written in the DAX language.  So my question is whether you would be OK with a solution in the M language?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.