cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper V

## Count of instances of ID occurrence

Hello,

I have a strange count requirments requirements. I want to count ID occurence for each day if ID rpeat next day it should not be counted. The outcome should be based on below attached picture.

It would be quite helpfulif I get it solved.

Thank you

1 ACCEPTED SOLUTION
Community Support

Hi @Junaid11 ,

``Flag = CALCULATE(MAX('Table'[AccountID]),FILTER(ALL('Table'), [AccountID]=MAX('Table'[AccountID])&& [Date]=MAX('Table'[Date])-1))``
``Count = COUNTROWS(FILTER('Table',[Flag]=BLANK()))``
``````Combine =
var _t=SUMMARIZE(FILTER('Table',[Date]=MAX('Table'[Date]) && [Flag]=BLANK()),[AccountID])
return CONCATENATEX(_t,[AccountID],",",[AccountID],ASC)``````

Output:

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

6 REPLIES 6
Community Support

Hi @Junaid11 ,

``Flag = CALCULATE(MAX('Table'[AccountID]),FILTER(ALL('Table'), [AccountID]=MAX('Table'[AccountID])&& [Date]=MAX('Table'[Date])-1))``
``Count = COUNTROWS(FILTER('Table',[Flag]=BLANK()))``
``````Combine =
var _t=SUMMARIZE(FILTER('Table',[Date]=MAX('Table'[Date]) && [Flag]=BLANK()),[AccountID])
return CONCATENATEX(_t,[AccountID],",",[AccountID],ASC)``````

Output:

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

Resolver II

Please add a calcualted colum which deterines if it should be counted as followes:

CountValue=

VAR this_row_account=Table[AccountID]

VAR this_row_date=Table[Date]

VAR Account_Present_Yesterday=

CALCULATE(COUNTROWS(Table),

FILTER(Table

,Table[AccountID]=this_row_account && Table[Date]=this_row_date-1)

RETURN

IF(Account_Present_Yesterday>0,Blank(),Table[AccountID])

Then - on the visual - count CountValue column.

Hope it helps,

David Ganor

Helper V

Hello @David-Ganor ,

This is what it shows and when I made it count then the below result came.

Resolver II

@Junaid11 please remove the account id column from the visual.

Helper V

Hello @David-Ganor ,

Yeah it is working for the count but can't we get the concatenation as (A,B,C,D,E) as mentioned?

Resolver II

@Junaid11  I'm not sure really...

Please try to make a measure using

CONCATENATEX

Something like this:

CONCATENATEX (
CALCULATETABLE ( VALUES ( 'Table'[Count Value] ) ),
Table[Count Value],
", ",            -- Separator (optional)
Table[Count Value],  -- Sorting expression (optional)
ASC              -- Sorting direction (optional)
)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.