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

Incremental CountIF DAX

I have a formula in excel that is =COUNTIF($P$2:$P2,P2) and have been looking around the forums for a replica in PBI but am having no luck.

 

Is anyone able to help me.. What the desired result is for example would be..

 

ID:                 Count:                          All i have been able to manage at the moment is this (which Is not helpful)

1                     1                                  1

2                     1                                  1

3                     1                                  3

3                     2                                  3

3                     3                                  3

4                     1                                  2

4                     2                                  2

5                     1                                  1

6                     1                                  1

 

Can someone please help out with this..

1 REPLY 1
vbisen
Frequent Visitor

Hi
You can add an Index column starting with 1 in your query. This will have unique value for each row.

Post this create calculated measure as 

Running Count =
CALCULATE(
COUNT('Table'[ID]),
FILTER(All('Table'), 'Table'[Index]<=MAX('Table'[Index])),
VALUES('Table'[ID])
)Running Count.png

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.