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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
rpinxt
Solution Sage
Solution Sage

Average line for a line in colum/line chart

I have a graph with columns and a line:

rpinxt_0-1698844021955.png

Now I wanted to have an average for this green line. So this would be a horizontal line all values per period divided by the number of periods with a value.

 

Tried it with quick measures and it made me this :

DPMO average per Period =
AVERAGEX(KEEPFILTERS(VALUES('dimDate'[Period])), CALCULATE([DPMO]))
 
But the restult is exactly the same line as the green line which you can (barely) see by the white labels.
 
How would I make a straight horizontal avarage line? A line that has the same amount for every period.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @rpinxt ,

Please try this mesure:

DPMO average per Period 1 = IF([DPMO]>=0 && NOT ISBLANK([DPMO]),CALCULATE(AVERAGEX(VALUES('dimDate'[Period]),[DPMO]),ALLSELECTED()))

vcgaomsft_0-1699345140601.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

9 REPLIES 9
rpinxt
Solution Sage
Solution Sage

Bottom line summary the DPMO average per Period is actually correct on a total level.

So if somebody knows how I can have this total on every line it would already be solved I guess:

DPMO average per Period =
AVERAGEX(KEEPFILTERS(VALUES('dimDate'[Period])), CALCULATE([DPMO]))
 
But as a workaround I was already thinking this :
rpinxt_0-1698852453196.png

Note: I put hardcoded the values in Test fields!

Test is the total of DPMO. No clue why on the total line it gives 1562 but if you count it in excel it is 13900.

Then Test 2 is the number of periods in the visual which is 13.

And finally a simple division would give me 1069 on every line.

 

But how would I get to the 13900 and 13?

rpinxt
Solution Sage
Solution Sage

Thanks @Data-estDog but I cannot see how I would put my own data in your solution.

 

My data is fairly simple.

Maybe this table representation makes it clearer:

rpinxt_0-1698846260055.png

So it is just an autocalendar generating periods.

And 1 measure returning amount.

The average now should look like:

rpinxt_1-1698846530829.png

 

And idealy it should only average when DPMO is greater than 0

 

*Edit: To add to this 1069 is the average but it does not show it on every line in the visual.

 

Data helps. 
Also, your data set is not as simple as you say. You are using a date dim, and DPMO is a measure which is why you used averagex to push it accross periods. 
So to simulate that:

DataestDog_0-1698848068046.png


Replace SUM(DPMO) with your measure.

 

 

Don't forget to mark as solution and give a thumbs up!

Well....there is not really a DPMO table.

This is the measure

DPMO = DIVIDE([Complaints#],[DPMO_ship],0) * 1000000

 

It is not a field from a table.

 

That's how I imagined it. 

Replace "DPMOMeasure" with your DPMO. Replace DPMOTable with whatever table Complaints# or DPMO_Ship come from. 

AvgDPMO = CALCULATE(AVERAGEX(DPMOTable, [DPMOMeasure]), ALLSELECTED(DPMOTable))

Sorry @Data-estDog but no luck with that.

 

I have a sample file here:

https://drive.google.com/file/d/1kFqaEQ0O2nE7hMAAFHbs4rUB0dsj8JEl/view?usp=drive_link

 

Maybe you can see for yourself there.

Anonymous
Not applicable

Hi @rpinxt ,

Please try this mesure:

DPMO average per Period 1 = IF([DPMO]>=0 && NOT ISBLANK([DPMO]),CALCULATE(AVERAGEX(VALUES('dimDate'[Period]),[DPMO]),ALLSELECTED()))

vcgaomsft_0-1699345140601.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

This is great @Anonymous ! 😄

Thanks a lot.

Maybe a stretch but the total is 13900 divided by 13 gives 1069.

 

What if it should not take the zeros in the average? So actually divide by 11 instead of 13.

Guess you would need to make it that DPMO not gives 0 but blank?

Data-estDog
Resolver II
Resolver II

Here's an example. It changes based on periods selected:
Avg resolved to closed =
CALCULATE (
    AVERAGEX (
        Sheet2,
        DATEDIFF ( Sheet2[resolved_date], Sheet2[Closed Date], MINUTE ) /*my measure*/
    ),
    ALLSELECTED ( Sheet2 )
)

 

If you want average accross all periods reguardless of filters, try: 

 

Avg resolved to closed2 =
AVERAGEX (
ALL ( Sheet2 ),
DATEDIFF ( Sheet2[resolved_date], Sheet2[Closed Date], MINUTE )
)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.