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
Junaid11
Helper V
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.

DEMO (1).PNG

It would be quite helpfulif I get it solved.

Thank you

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Junaid11 ,

 

Please create below measures:

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:

Eyelyn9_0-1644914672783.png


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.

View solution in original post

6 REPLIES 6
v-eqin-msft
Community Support
Community Support

Hi @Junaid11 ,

 

Please create below measures:

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:

Eyelyn9_0-1644914672783.png


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.

David-Ganor
Resolver II
Resolver II

Hi @Junaid11 

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

Hello @David-Ganor ,

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

dfsdfsdfsdfsdf.PNGffdfdfdfdfdf.PNG

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

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?

@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)
        )

 

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.