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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Distinct count of ID based on Latest Status

Hello everyone,

 

I am new to Power BI and need some help. 

 

I have Order ID, Order status and Time modified(Time when the Order status was changed) as columns.

My data looks like this:

Order IDOrder StatusTime modified
111010/02/2023 15:00:00
111710/02/2023 15:05:00
112010/02/2023 16:00:00
112410/02/2023 16:05:00
112010/02/2023 17:05:00
222010/02/2023 12:00:00
222710/02/2023 12:10:00
333010/02/2023 11:00:00
333410/02/2023 12:00:00
333710/02/2023 12:02:00
333010/02/2023 12:30:00
444010/02/2023 13:30:00
444410/02/2023 14:30:00

 

I need the distinct count of Order ID for each day based on the latest Order Status(Order Status changes with time and only the latest Order Status should be considered). 

I need a measure Order Count such that the result looks like this:

DateOrder StatusOrder Count
10/02/202302 //Order ID=112 and 333
10/02/202372 //Order ID=111 and 222
10/02/20234//Order ID=444

 

Any help would be appreciated.

 

Thank you,

Akshay

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Ashish_Mathur_0-1716011827825.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

ThxAlot
Super User
Super User

Only one calculated column is needed with WINDOW function; but it requires profound comprehension of DAX.

ThxAlot_0-1716087126135.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

3 REPLIES 3
ThxAlot
Super User
Super User

Only one calculated column is needed with WINDOW function; but it requires profound comprehension of DAX.

ThxAlot_0-1716087126135.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Ashish_Mathur_0-1716011827825.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Anonymous , Create measures like

 

M1  =
VAR MaxTime = CALCULATE(
MAX('Table'[Time modified]),
ALLEXCEPT('Table', 'Table'[Order ID], 'Table'[Date Only])
)
RETURN
IF('Table'[Time modified] = MaxTime, TRUE(), FALSE())

 

 

Order Count =
SUMX(
VALUES('Table'[Date Only]),
CALCULATE(
DISTINCTCOUNT('Table'[Order ID]),
[M1] = TRUE()
)
)

 

Latest Date
https://amitchandak.medium.com/power-bi-get-the-last-latest-value-of-a-category-d0cf2fcf92d0

https://amitchandak.medium.com/power-bi-get-the-sum-of-the-last-latest-value-of-a-category-f1c839ee8...

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.