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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
matus_jun
Frequent Visitor

How to count Consecutive with duplicate date

Hi I want to know how to count 

matus_jun_0-1738051787690.png

From this picture
shift_date = date employee work
sum = worhing hour 8 is normal work time and 2 is overtime 
So I got duplicate shift_date 
group_id = Consecutive date 
Count_Column = count day Consecutive
In group_id = 1 ,I should get 6 
this is my dax for counting 

Count_Column = CALCULATE(COUNT(table[group_id]),FILTER(ALL('table'),table[employee_id]=EARLIER(table[employee_id])&&table[group_id]=EARLIER(table[group_id])))
I work fine without duplicate date
please help me to count same way with duplicate date 
Thank you alot and sorry for my english

 

 

4 REPLIES 4
bhanu_gautam
Super User
Super User

@matus_jun , Try using Distinct

 

Count_Column =
CALCULATE(
COUNTROWS(
DISTINCT(
SELECTCOLUMNS(
FILTER(
ALL('table'),
'table'[employee_id] = EARLIER('table'[employee_id]) &&
'table'[group_id] = EARLIER('table'[group_id])
),
"shift_date", 'table'[shift_date]
)
)
)
)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






EARLIER/EARLIEST refers to an earlier row context which doesn't exist. 
It show like this i dont understand how EARLIER work

Fowmy
Super User
Super User

@matus_jun 

I suggest, you transform the data in Power Query so that you will have to get rid of the duplicate records and two seperate columns one for Total Hours and one for OT, this way you will be to do your aggregations easily in Power BI

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

how to do this can you help me I try but not working

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.