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

DAX - Incrimental Count of a Column

Hello All,

 

I am new to power bi and DAX,

 

I am trying to calculate count of a column in incremental way in a CALCULATED COLUMN so that i can find out how any times that value got repeated.

 

Data and required output as mentioned below 

Capture.PNG

 

Any help please.

 

Thanks,

Mohan V.

3 ACCEPTED SOLUTIONS
Fowmy
Super User
Super User

@Anonymous 

Use can do in Dax by sorting YEAR, then  COLUMN1 and adding an index number in Power Query, then add below create below column in the model:

Result = 
CALCULATE(
    COUNTROWS('Table'),
        CALCULATETABLE('Table',
            'Table'[Sequence]<=EARLIER('Table'[Sequence])
        )         
)

Fowmy_0-1595574748486.png

 

It will be ideal to add it using Power Query:

Refer to this: poet and video: https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

Let me know if it doesn't work.

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

amitchandak
Super User
Super User

@Anonymous , you need add and index column

and then have it like this

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

new column = countx(filter(Table,[year] =earlier([Year]) && [column1] = earlier([column1]) && [index] <= earlier([index])),[index])

View solution in original post

v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

First, you need to create an index colum in query editor:

Capture5.PNG

 

Then you can use the following calculated column:

 

Column = CALCULATE(COUNT('Table'[Column1]),FILTER(ALLEXCEPT('Table','Table'[Year],'Table'[Column1]),'Table'[Index]<=EARLIER('Table'[Index])))

 

 

Capture6.PNG

 

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

 

Best Regards,

Dedmon Dai

 

View solution in original post

3 REPLIES 3
v-deddai1-msft
Community Support
Community Support

Hi @Anonymous ,

 

First, you need to create an index colum in query editor:

Capture5.PNG

 

Then you can use the following calculated column:

 

Column = CALCULATE(COUNT('Table'[Column1]),FILTER(ALLEXCEPT('Table','Table'[Year],'Table'[Column1]),'Table'[Index]<=EARLIER('Table'[Index])))

 

 

Capture6.PNG

 

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

 

Best Regards,

Dedmon Dai

 

amitchandak
Super User
Super User

@Anonymous , you need add and index column

and then have it like this

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

new column = countx(filter(Table,[year] =earlier([Year]) && [column1] = earlier([column1]) && [index] <= earlier([index])),[index])

Fowmy
Super User
Super User

@Anonymous 

Use can do in Dax by sorting YEAR, then  COLUMN1 and adding an index number in Power Query, then add below create below column in the model:

Result = 
CALCULATE(
    COUNTROWS('Table'),
        CALCULATETABLE('Table',
            'Table'[Sequence]<=EARLIER('Table'[Sequence])
        )         
)

Fowmy_0-1595574748486.png

 

It will be ideal to add it using Power Query:

Refer to this: poet and video: https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

Let me know if it doesn't work.

________________________

Did I answer your question? Mark this post as a solution, this will help others!.

I accept KUDOS 🙂

YouTube, LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

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.