Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Naresh91
Microsoft Employee
Microsoft Employee

Count the Open Account Numbers per each category with latest date

Hi ,

 

i have the below Table

AccIDCategoryAccStatusDate
ab133xyzOpen1/1/2020
ab133abcOpen1/1/2020
ab133cdeOpen1/1/2020
ab133efzClosed1/1/2020
cd354xyzOpen1/6/2020
cd354abcClosed1/2/2020
dc566cdeOpen1/3/2020
gf345xyzOpen1/4/2020

 

i want to calculate "AccID" who have the "AccStatus" as "Open" for each "Category" with Latest Date.

 

 

it has to count the Highlighted Rows

 
AccIDCategoryAccStatusDate
ab133xyzOpen1/1/2020
ab133abcOpen1/1/2020
ab133cdeOpen1/1/2020
ab133xyzClosed1/2/2020
ab133efzClosed1/1/2020
cd354xyzOpen1/2/2020
cd354abcClosed1/6/2020
dc566cdeOpen1/3/2020
gf345xyzOpen1/4/2020
gf345xyzClosed1/1/2020

 

 

1 REPLY 1
amitchandak
Super User
Super User

@Naresh91 ,

if this measure >0 , the you need to color the column as green using conditional formatting 

new Count =
VAR __id = MAX ('Table'[AccID] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[AccID] = __id , 'Table'[AccStatus] = "Open")
CALCULATE ( Count ('Table'[Date] ), VALUES ('Table'[AccID] ),'Table'[AccID] = __id,'Table'[Date] = __date , 'Table'[AccStatus] = "Open" )+0

 

 

max open date 

new Date =
VAR __id = MAX ('Table'[AccID] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[AccID] = __id , 'Table'[AccStatus] = "Open")
CALCULATE ( Max ('Table'[Date] ), VALUES ('Table'[AccID] ),'Table'[AccID] = __id,'Table'[Date] = __date , 'Table'[AccStatus] = "Open" )

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.