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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
pardeepd84
Helper III
Helper III

Count multiple rows for duplicate including blanks

Hi,

First of all apologies if this is a duplicate request, I am trying to create a measure that will count multiple columns, if any of the rows are blank then it would return 0.  The columns are ID number, start date, start time - if any of these are blank then I would need it to return 0, also if any of the rows in all 3 column are all the same I need it count the number of entries it appears in the entire dataset.

Please see table below, the 4th column named results is what I want my measure to return.

 

ID          Start Date      Start Time   Results
1234                                                     0
            11/01/2021         15:30             0
9876    11/01/2021          09:05            1
9876    13/01/2021         13:45             1
3456    01/02/2021        19:30              2
3456    01/02/2021        19:30              2
6789    16/01/2021        19:30              3
6789    16/01/2021       19:30               3
6789    16/01/2021       19:30               3

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @pardeepd84 

 

Please try the below measure.

 

Result =
VAR currentid =
MAX ( 'Table'[ID] )
VAR currentdate =
MAX ( 'Table'[Start Date] )
VAR currenttime =
MAX ( 'Table'[Start Time] )
VAR newtable =
FILTER (
ALL ( 'Table' ),
'Table'[ID] <> BLANK ()
&& 'Table'[Start Date] <> BLANK ()
&& 'Table'[Start Time] <> BLANK ()
&& 'Table'[ID] = currentid
&& 'Table'[Start Date] = currentdate
&& 'Table'[Start Time] = currenttime
)
RETURN
COALESCE ( COUNTROWS ( newtable ), 0 )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @pardeepd84 

 

Please try the below measure.

 

Result =
VAR currentid =
MAX ( 'Table'[ID] )
VAR currentdate =
MAX ( 'Table'[Start Date] )
VAR currenttime =
MAX ( 'Table'[Start Time] )
VAR newtable =
FILTER (
ALL ( 'Table' ),
'Table'[ID] <> BLANK ()
&& 'Table'[Start Date] <> BLANK ()
&& 'Table'[Start Time] <> BLANK ()
&& 'Table'[ID] = currentid
&& 'Table'[Start Date] = currentdate
&& 'Table'[Start Time] = currenttime
)
RETURN
COALESCE ( COUNTROWS ( newtable ), 0 )

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
amitchandak
Super User
Super User

@pardeepd84 , Try a measure like

countrows(Table)+0

or

countrows(Filter(allselected(Table),[ID] =max([ID])))

or

Count(Table[ID]) +0

 

or

CountX(Filter(allselected(Table),[ID] =max([ID])),Table[ID])

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.