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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Tobias106
Helper I
Helper I

Calculate/Create a total value an show this value as an average line

Hello everbody,

 

I have a line chart with 12 month in the x-axis.

My question: How can I calculate the red Total A/B with 0,194 and show this Total as linear average line with the 0,194 for all month?

 

Month123...12Total
A546 419
B302630 1298
A/B0,170,150,20 0,330,194

 

Thank you 🙂

Tobias

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Let:
Month field = Table  [month]
A/B field = Table [A/B]

[Values Displayed] = SUM(Table[Value])

Try:

 

Linear average =
VAR _A =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "A" )
VAR _B =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "B" )
RETURN
    DIVIDE ( _A, _B )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

4 REPLIES 4
PaulDBrown
Community Champion
Community Champion

Try:

Linear average =
VAR _A =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "A" )
VAR _B =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "B" )
RETURN
    IF ( ISBLANK ( [Values Displayed] ), BLANK (), DIVIDE ( _A, _B ) )




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Thank you again, it works. You are my life-saver 🙂

PaulDBrown
Community Champion
Community Champion

Let:
Month field = Table  [month]
A/B field = Table [A/B]

[Values Displayed] = SUM(Table[Value])

Try:

 

Linear average =
VAR _A =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "A" )
VAR _B =
    CALCULATE ( [Values Displayed], ALL ( Table[month] ), Table[A/B] = "B" )
RETURN
    DIVIDE ( _A, _B )

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown Thank you very much - it works perfectly 🙂

 

But one thing appears.

In my Datasource Excel I have blank lines. Now I get the correct result 0,194, but not only for the month 1-12. I also have a additional blank row. How can I exclude it per code? 

 

MonthA/B
Blank0,194
10,194
20,194
30,194
...0,194
120,194

 

Thank you again and have a nice day!

Tobias

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors