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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Orders Open Trend by Day

The data below in green is what I have in my table. 

 

I need to find a way to calculate how many orders were open on a specific date based on the date they were opened and closed. The expected output is below and I would like to do a trend. 

 

How can I accomplish this in Power BI?

 

kweibelt_0-1628112689645.png

 

14 REPLIES 14
RickV_MIA
New Member

This is Awesome thanks for this solution.

We are able to measure Open and Closed Orders by Date in SSAS

We can review by shop

RickV_MIA_0-1699642631956.png

 

v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Has your problem been solved? If it is solved, please mark a reply which is helpful to you.

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

 

Best Regards,
Winniz

Anonymous
Not applicable

not 100%, i implemented the suggestion and it does not return the results I am expecting. Let me get some data to share.

 

Hi @Anonymous ,

 

Please create a new table:

 

Date = CALENDAR(MIN('Table'[Open Date]),MAX('Table'[Close Date]))

vkkfmsft_0-1628818969562.png

 

Then create measure:

 

Measure = 
SWITCH(
    TRUE(),
    MAX('Date'[Date]) < MAX('Table'[Open Date]), "NA",
    MAX('Date'[Date]) >= MAX('Table'[Open Date])
        && ( MAX('Date'[Date]) < MAX('Table'[Close Date]) 
                || MAX('Table'[Close Date]) = BLANK() ), "Open",
    MAX('Table'[Close Date]) <> BLANK()
        && MAX('Date'[Date]) >= MAX('Table'[Close Date]), "Close"
)

 image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

This is working great for the chart as shown above. Now how do I get a chart where I can count how many are open on any given day? 

Hi @Anonymous ,

 

Try the following formula:

 

OpenCount = 
CALCULATE(
        DISTINCTCOUNT('Table'[Sales Order]),
        FILTER( 'Table', [Measure] = "Open" )
)

 image.png

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

I am looking at the data now and the counts are not correct. 

The formula is only counting orders that were created on 8/13 and are open. It needs to also count the orders that were created prior to 8/13 and are still open. 

 

Here are my formulas:

kweibelt_1-1629132200431.pngkweibelt_2-1629132231731.png

 

kweibelt_0-1629131665072.png

 

Hi @Anonymous ,

 

Please try the following formula:

 

OpenCount = 
CALCULATE(
        DISTINCTCOUNT('vSalesOrder_Holds'[SO]),
        FILTER( ALLSELECTED('vSalesOrder_Holds'[SO]), [Measure] = "Open" )
)

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

I appreciate all of the help with this but I am still not getting the expected results. This report runs each morning as a snapshot and tells me that there are anywhere from 200-400 open orders. The numbers I am getting are still not as expected. 

 

What I am trying to get to is the number of orders that were open on the date listed in the chart. I am not sure what info I can give here to help accomplish this. 

 

kweibelt_0-1629500734305.png

 

Hi @Anonymous ,

 

These formulas work fine in my sample data. Not sure why you didn’t get the correct results. Could you please share your PBIX file? Or you can try to export the visual data into a CSV file, and see how many values are "open" in each Date.

 

vkkfmsft_1-1629708959098.png

vkkfmsft_0-1629708867779.png

 

Best Regards,
Winniz

 

Hi,

Share some data and show the expected result.


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

Please see this DAX pattern for how to solve this one.

Events in progress – DAX Patterns

 

Pat

 





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

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Thanks so much! I am trying it out now. 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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