Forum Discussion
EWBWEBB
3 years agoHelper III
Counting instances
Hi there I am trying to count the instances of Covid over a period of time. There are two piece to this. 1.) how do I count the instances where the first instance would be labelled 1 and the...
- 3 years ago
Hi,
Please check the below picture and the attached pbix file.
Total count CC = COUNTROWS ( FILTER ( Data, Data[UNID] = EARLIER ( Data[UNID] ) && Data[From Date] <= EARLIER ( Data[From Date] ) ) )In year count CC = COUNTROWS ( FILTER ( Data, Data[UNID] = EARLIER ( Data[UNID] ) && YEAR ( Data[From Date] ) = YEAR ( EARLIER ( Data[From Date] ) ) && Data[From Date] <= EARLIER ( Data[From Date] ) ) ) - 3 years ago
Hi,
Thank you for your reply.
I am not sure if I correctly understood your second questions, but please check the below picture and the attached pbix file whether it suits your requirement.
Expected CC = VAR _toponebyyeartable = TOPN ( 1, FILTER ( Data, Data[UNID] = EARLIER ( Data[UNID] ) && YEAR ( Data[From Date] ) = YEAR ( EARLIER ( Data[From Date] ) ) ), Data[In year count CC], DESC ) RETURN IF ( MAXX ( _toponebyyeartable, Data[In year count CC] ) = Data[In year count CC], Data[In year count CC] )
Jihwan_Kim
3 years agoSuper User
Hi,
Please check the below picture and the attached pbix file.
Total count CC =
COUNTROWS (
FILTER (
Data,
Data[UNID] = EARLIER ( Data[UNID] )
&& Data[From Date] <= EARLIER ( Data[From Date] )
)
)
In year count CC =
COUNTROWS (
FILTER (
Data,
Data[UNID] = EARLIER ( Data[UNID] )
&& YEAR ( Data[From Date] ) = YEAR ( EARLIER ( Data[From Date] ) )
&& Data[From Date] <= EARLIER ( Data[From Date] )
)
)