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
UlliJ
New Member

Conditional average

I am quite new to powerBI and I feel like I have tried everything to solve this. 

The table below indicates time spent producing an order (Behandlingstid = total working days). As you can see every row indicates a product, but an order can extend beyond one row depending on no of products (the products don't necessarily have to be the same, that is just a coincidence).

 

I want the average of total working days pr order, but I just simply cannot figure out how.

 

Kind regards,

Ulrikke

CaptureV.PNG

7 REPLIES 7
Phil_Seamark
Employee
Employee

Hi @UlliJ

 

So do you want to sum up the Behandlingstid for each row per order.  And then work out the average across all orders?  Or are you after an an average of the rows within the order?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark

 

Thank you for your fast response.

 

I want the average pr order so I can calculate the average for all orders, not just the average per row. Does that make sense?

Can you please cut/paste some sample data to save having to type it into a local copy of PBIX 🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

This is how new I am to this that I am not quite sure what you mean, but reading your question again it is the latter part I want. "Or are you after an an average of the rows within the order?"

 

Ulrikke

Hi @UlliJ

 

Nah, what I meant was to provide some data in the form of text rather than a screenshot of an image,  What makes it easier to suggest formulas for you to use is to try and simulate your model as much as possible here.  I type in to a new PBI Desktop file your data but that takes too long and is prone to error.  🙂


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Hi @Phil_Seamark,

 

Will this help? Never mind the time, I am interested in working days (which is the behandlingstid). As you can se each order has several products lines. These are completed at several different times. I want the average pr order, so that I again can find the average pr week, month etc usind DISTINCTCOUNT for order. Any suggestions? 

Opprettet datoOppr. klFerdigm.datoFerdigm.kl.OrdrenrProduktnrFerdigmeldtTotalt antallBehandlingstid
03.01.201713:3804.01.201712:47353241198101332
03.01.201713:3804.01.201712:47353241235100112
03.01.201713:3804.01.201712:47353241628100222
03.01.201713:3804.01.201712:47353241672191222
03.01.201713:3804.01.201712:47353241656100112
03.01.201713:5811.01.201709:17353243555002117
03.01.201713:5811.01.201709:17353243532100117
03.01.201713:5811.01.201709:17353243555003117
03.01.201713:5811.01.201709:17353243153100117
03.01.201713:5811.01.201709:1735324339810010107
03.01.201713:5811.01.201709:17353243091301557
03.01.201713:5811.01.201709:1735324309110120207
03.01.201713:5811.01.201709:17353243091146557
03.01.201713:5818.01.201714:293532436571005512
03.01.201713:5811.01.201709:1735324353710025257
03.01.201713:5811.01.201709:1735324353210025257
03.01.201713:5811.01.201709:1735324362600030307
03.01.201713:5811.01.201709:17353243361100117
03.01.201713:5811.01.201709:17353243852100887
03.01.201713:5811.01.201709:17353243plukk117
03.01.201714:2205.01.201710:29353244629100552
03.01.201714:2226.01.201711:043532445318007718
03.01.201714:2205.01.201710:29353244533122222
03.01.201714:2205.01.201710:29353244619100222
03.01.201714:2205.01.201710:29353244839100112
03.01.201714:2205.01.201710:29353244331418112
03.01.201714:2226.01.201711:04353244533416112

Hi @UlliJ

 

This calculated column gives you the average duration per order.  Is this along the lines of what you need?

 

Average 1 = CALCULATE(AVERAGE('Table3'[Behandlingstid]),ALLEXCEPT('Table3','Table3'[Ordrenr]))

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.