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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HansBaeten
Frequent Visitor

Count first occurence of order when state is equal to a value

Hi,

 

I have a dataset like this (only the first 4 columns, last column is only to indicate if I need the row in my final result or not):

 

DateTimeOrderStatus To count
4/11/201921:001Started Yes
4/11/201922:001Hold  
4/11/201923:001Started  
5/11/20195:001Started  
5/11/20195:301Started  
5/11/20196:451Stopped  
3/11/201922:302Started Yes
3/11/201923:002Started  
4/11/20191:302Started  
4/11/20193:002Started  
3/11/201923:003Started Yes
4/11/20191:303Started  
4/11/201921:004Started Yes
4/11/201922:004Hold  
4/11/201923:004Started  
5/11/20195:004Started  
5/11/20195:304Started  
5/11/20196:454Stopped  

 

I want to be able to count the number of orders by day, but only the first occurence of the order + when the state = Started. The desire result should look like:

 

DateCount
3/11/20192
4/11/20192
5/11/20190

 

Who can help me?

 

Thanks.

 

Regards,

Hans

 

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@HansBaeten ,

 

Could you please explain the logic of "first occurence of the order"?

 

Regards,

Jimmy Tao

@v-yuta-msft,

 

I only want to count records where the state "started" appeared for the first time on an order level.

 

In my example, state "started" appeared for the first time at 4/11/2019 21:00 for order 1. From this moment on, I'm no longer interested in the other states "started" of the same order.

 

Actually, I want to see when an order was actually started. The order keeps this state until there is a change of state.

In case of order 1: if I do a simple count by day, I will have a result on 4/11 and 5/11 (both days are having a state started). But an order can be started only once.

 

Hope this clarifies my requirement?

 

Thanks in advance for your help.

 

Regards,

Hans

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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