cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Average number of days per state + present in chronological order

I have simple lab repair data for customer orders:

1) I want to calculate the average days by state:

image.png

2) Also, I want to present it in chronological order (the order starts as "new" -> "work" -> "revision" -> "closed")

How can I present it?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper I
Helper I

Re: Average number of days per state + present in chronological order

I added column in my SQL source with RANK() and DATEDIFF in seconds to get the desired solution.

Thanks for everyone for your help with this

View solution in original post

5 REPLIES 5
Highlighted
Community Champion
Community Champion

Re: Average number of days per state + present in chronological order

It looks like you already have your average cycle time.  To get them to sort in the desired order, add a calculated column to your table with a switch() formula like this:

 

Status Sort = Switch([Status], "new", 1, "work, 2, "revision", 3, "closed", 4)

 

Then highlight your Status column and choose the new columns as your Sort By Column.  This will make them show up in that order in your visuals.

 

If this works for you, please mark it as the solution.  Kudos are great too.  Please let me know if it doesn't or if any questions.
Regards,
Pat

Highlighted
Super User I
Super User I

Re: Average number of days per state + present in chronological order

Hi @yanivshe 

You may use AVERAGEX to get the desired result. Try this as a measure:

Averagex = 
AVERAGEX ( VALUES ( States[STATE] ), AVERAGE ( States[Value] ) )
 

For the sort, create a conditional column  in the query editor instead of using DAX to create a sort column. You will get an error if you sort a column by a calculated column that is dependent to the column being sorted like below.

sort error.png

 

Do something like below in the query editor.

conditional column.png






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa
Highlighted
Super User IV
Super User IV

Re: Average number of days per state + present in chronological order

Hi,

What does your source dataset look like?  Share that.


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

Re: Average number of days per state + present in chronological order

I added column in my SQL source with RANK() and DATEDIFF in seconds to get the desired solution.

Thanks for everyone for your help with this

View solution in original post

Highlighted
Helper I
Helper I

Re: Average number of days per state + present in chronological order

I added the column to my SQL source with RANK() and DATEDIFF in seconds to get the desired solution.

Thank you for each for your help with this

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors