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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Control Chart in Power BI

Hi All, 

 

I am trying to create a control chart using power bi. 

I have the date column in my data table name "Date". I have the parameters in another column (oil variance)

 

So to create the average line, I use this calculation:

Average Oil Variance = CALCULATE(AVERAGEX(DATA,DATA[Oil Variance]),ALLSELECTED(DATA[Date]))
 
The line shows the correct number but the thing is it is now appear for the whole year no regards to my slicer. For example below is the snapshot when I choose April (1st pic) and July (2nd pic)
 
handy_pratama_0-1627386833829.pnghandy_pratama_1-1627386862747.png

 

The navy blue line it self shows correct number, so when I choose April it shows average of April, when I choose July it shows average of July.

 

What I want is, when I choose the slicer, the axis date will adjust themselves to only the selected month (before average line was there, it do what I want).

 

I try to modified the calculation to:

Average Oil Variance = CALCULATE(AVERAGEX(DATA[Date],DATA[Oil Variance]),ALLSELECTED(DATA[Date]))

 

But it give error

handy_pratama_2-1627387036179.png

 

 

Any idea how to overcome this?

 

Thanks in advance.


Best Regards,

Handy Pratama

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to the error message, the averagex function returns the average value of the expression calculated for each row in the table, AVERAGEX (<table name>, <expression> ). "Table name" is a table that uses expression to evaluate each row: "Expression" is an expression that is evaluated for each row of the table. Refer to the following formula.

Average Oil Variance = 
CALCULATE (
    AVERAGEX ( 'DATA', DATA[Oil Variance] ),
    ALLSELECTED ( DATA[Date] )
)

vhenrykmstf_0-1627544719832.png


If the problem is still not resolved, can you provide an effective data model (delete sensitive information), I will answer you as soon as possible.


Best Regards,
Henry


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

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank You all for your reply I already accept as solution.

v-henryk-mstf
Community Support
Community Support

Hi @Anonymous ,

 

According to the error message, the averagex function returns the average value of the expression calculated for each row in the table, AVERAGEX (<table name>, <expression> ). "Table name" is a table that uses expression to evaluate each row: "Expression" is an expression that is evaluated for each row of the table. Refer to the following formula.

Average Oil Variance = 
CALCULATE (
    AVERAGEX ( 'DATA', DATA[Oil Variance] ),
    ALLSELECTED ( DATA[Date] )
)

vhenrykmstf_0-1627544719832.png


If the problem is still not resolved, can you provide an effective data model (delete sensitive information), I will answer you as soon as possible.


Best Regards,
Henry


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

Anonymous
Not applicable

Hi @amitchandak 


Thank you for your reply. I try your solution and it gave me this error

handy_pratama_0-1627388958322.png

 

I think its coming from the Data[Date] As i have date as column in my data table. I really new to power BI so I am not quite sure if I doing it right.

 

Do you have further advice?

 

Thanks in advance.


Best Regards,
Handy Pratama

 

 

amitchandak
Super User
Super User

@Anonymous , Is the axis is drived from DATA[Date], I doubt that.

I think it is using date or calendar table.

 

If yes use ALLSELECTED(Date[Date])

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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