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 first Occurance of ID in a measure

Hi,

 

Im stuck, calling DAX experts help.

 

I need to achieve:

Count of Earliest ID (first ID) and visualize it on the date it occured on.

 

For example, If 1400 Unique IDs are generated over 2 months, I need to know 86 occured on X day and 302 occured on Y day. Where X and Y should be indepedent / exclusive from each other.

 

I plan to filter this dynamic by date, so the time range will change and hence a column isnt an option. I have tried with classic DAX DistinctCounts and also with Virtual Tables. In both cases I am overcounting as when I visualize it, it takes the Unique/Dinstinct Count for that day, rather than breaking down the total distinct count number and putting them in groups where they first occured in the time series.

 

Here's the code Ive tried:

x_test =
var __table = 'fact_Entry Log'
var __table1 = ADDCOLUMNS(__table, "Column",
IF (
CALCULATE (
COUNTROWS ( 'fact_Entry Log' ),
FILTER (
ALLEXCEPT ( 'fact_Entry Log', 'fact_Entry Log'[Personal ID] ),
'fact_Entry Log'[date_key] <= EARLIER ( 'fact_Entry Log'[date_key] )
)
)
> 1,
0,
1
) )
VAR calc = COUNTROWS(FILTER(__table1, [Column] = 0) )
RETURN
calc
1 REPLY 1
lbendlin
Super User
Super User

Isn't the "count of earliest ID" always 1 ? What are you actually trying to show?

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.