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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Syndicate_Admin
Administrator
Administrator

COUNTING ROWS DAX TABLE

Hello Good day,

I'm having a table where I have a list of car brands and I need to do two types of counting in Dax:

1. The first count is called CONTEO_A, and in this field I need to count how many times each brand of car is repeated within the total records.

2. The second count is called CONTEO_B, and in this field I need to count consecutively the number of times the car mark is repeated.

Here is an image of what I need to do:

MARCHCONTEO_ACONTEO_B
Acura 21
Acura 22
Audi 21
Audi 22
BMW 11
Buick 41
Buick 42
Buick 43
Buick 44
Cadillac 21
Cadillac 22
Chevrolet 41
Chevrolet 42
Chevrolet 43
Chevrolet 44

For example the Chevrolet brand is repeated 4 times within the list, for this reason the CONTEO_A field, has the number 4, but the CONTEO_B field, has the consecutive counting numbers from 1 to 4.

Thank you very much for your help.

1 ACCEPTED SOLUTION

Hi,

Thank you for sharing.

If your table has an index column like above, please check the attached pbix file below.

 

I changed the sample in the pbix file.

I hope this helps.

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Hello, not actually the table has no date, but I see that it is necessary to be able to perform the counts, how can I implement that date column that is not manually?

Hi,

If you do not have date column, what other columns does this table have? Index number column? Or, please share your sample pbix file's link here, and then I can try to look into it to come up with a more accurate solution.

Or, you can try to add index column in just one click in Power Query Editor.

Thanks.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hello, if the table has index, it is a large list of brands, I send you the .pbix, I appreciate your help. I send you the data here I did not know how to attach the .pbix

IndexMARCH
1Acura
2Acura
3Audi
4Audi
5BMW
6Buick
7Buick
8Buick
9Buick
10Cadillac
11Cadillac
12Chevrolet
13Chevrolet
14Chevrolet
15Chevrolet

Hi,

Thank you for sharing.

If your table has an index column like above, please check the attached pbix file below.

 

I changed the sample in the pbix file.

I hope this helps.

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Jihwan_Kim
Super User
Super User

Hi,

I assume the table has something like a date column, like below.

Please check the below picture and the attached pbix file.

It is for creating a new columns.

 

Jihwan_Kim_0-1667287374227.png

 

 

Conteo A CC = 
VAR _currentmonth =
    MONTH ( Data[Date] )
VAR _currentbrand = Data[Brand]
RETURN
    COUNTROWS (
        FILTER (
            Data,
            MONTH ( Data[Date] ) = _currentmonth
                && Data[Brand] = _currentbrand
        )
    )

 

Conteo B CC =
VAR _currentmonth =
    MONTH ( Data[Date] )
VAR _currentdate = Data[Date]
VAR _currentbrand = Data[Brand]
RETURN
    COUNTROWS (
        FILTER (
            Data,
            MONTH ( Data[Date] ) = _currentmonth
                && Data[Date] <= _currentdate
                && Data[Brand] = _currentbrand
        )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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