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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Count Rows using measure

Hello,

 

I have below data

DateVehicle NOIn/Outstatus
01-01-20231Inboundcomp
02-01-20232Inboundnon-comp
03-01-20233Inboundnon-comp
04-01-20234Outboundcomp
05-01-20231Outboundnon-comp
06-01-20232Outboundcomp
07-01-20233Outboundcomp
08-01-20234Inboundcomp
09-01-20235Outboundnon-comp

 

if i use cards for total uniqe vehicle it will give me 5 and for uniqe comp vehicle it will give me 4 but i want data as per last status as i sort data in descending order and delete duplicate vehicles numbers then only there will be 3 Comp vehicles and that is the number i required in cards using measure so any one have any clue regarding calculation i would appreciate it.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

You could achieve this by creating two measures.

delete duplicate vehicles numbers = COUNTROWS(FILTER(ALLSELECTED('Table'),[status]="comp"&&[Vehicle NO]=MAX('Table'[Vehicle NO])))
the number you required = CALCULATE(DISTINCTCOUNT('Table'[Vehicle NO]),FILTER(ALLSELECTED('Table'),[delete duplicate vehicles numbers]=1))

 

vstephenmsft_0-1672989293106.png

 

 

Best Regards,

Stephen Tao

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

You could achieve this by creating two measures.

delete duplicate vehicles numbers = COUNTROWS(FILTER(ALLSELECTED('Table'),[status]="comp"&&[Vehicle NO]=MAX('Table'[Vehicle NO])))
the number you required = CALCULATE(DISTINCTCOUNT('Table'[Vehicle NO]),FILTER(ALLSELECTED('Table'),[delete duplicate vehicles numbers]=1))

 

vstephenmsft_0-1672989293106.png

 

 

Best Regards,

Stephen Tao

 

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

Mahesh0016
Super User
Super User

@Anonymous 

Mahesh0016_0-1672922779620.png

Mahesh0016_1-1672922884157.png

 


*If this post helps, please consider accept as solution to help other members find it more quickly and Appreciate your Kudos.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.