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

Line Charts with Cumulative values

 I have my data like this (image below)

 

Capture.PNG

Now i need to create a line chart in Power BI. I am getting something like this (sample image below)

 

Capture.PNG

 

Just for illustration i used this chart (Target and Actuals are two lines). 

 

Now i need the lines to be cumulative over months. How can i do that in Power BI?

1 ACCEPTED SOLUTION
v-huizhn-msft
Employee
Employee

Hi @GaRaGe,

First, you should create a calculated column to get a number format month. If we use the Jan, Feb, Mar and so on. Month will order by alphabet.

Month! = SWITCH(Test[Month],"Jan",1,"Feb",2,"Mar",3,"Apr",4,"May",5,"Jun",6,"Jul",7,"Aug",8,"Sep",9,"Oct",10,"Nov",11,12)


1.PNG

Then create two measure for cumulative spend over month. 

Target = CALCULATE(SUM(Test[Spend]),FILTER(ALL(Test),Test[Month!]<=MAX(Test[Month!])&&Test[Metric]="Target"))

Actual = CALCULATE(SUM(Test[Spend]),FILTER(ALL(Test),Test[Month!]<=MAX(Test[Month!])&&Test[Metric]="Actual"))

Finally, create a line chart, select the [month!] field as axis, the two measures as value level.

2.PNG

Please feel free to ask if you any issue.

Best Regards,
Angelia

View solution in original post

26 REPLIES 26

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


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

thanks that fixed it using DATESYTD, but why wouldn't the other method work? 

You are welcome.  If my previous reply helped, please mark that as Answer.  You were simply not using the correct function.


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

Hiiii

I have data like this

NumberCompanyDateOperating RevenueProfit after TaxROCE (%)Operating Margin (%)Net Margin (%)EPS Growth (%)
1TIL(Grove)17-Mar325.3126.4514.3762.55.3160.68
  16-Mar1,736.27-43.599.436.68-2.5-1,023.51
  15-Mar1,471.564.7211.7410.650.32-52.47
  14-Mar1,312.589.9310.149.450.75130.39
  13-Mar1,173.654.318.498.250.36-71.9
  12-Mar1,381.6015.3410.386.471.1-74.51
  11-Mar1,376.1060.1924.569.834.351.12
2Eicher7-Mar031.3771.04-99.461,928.10
  6-Mar01.555.78-34.5-51.39
  5-Mar03.1811.16-84.79102.12
  4-Mar02.861.76-94.39131.39
  3-Mar555.37-9.113.546.48-1.6217.26
  2-Mar------
  1-Mar------

 

I want company name as y axis and 

DateOperating RevenueProfit after TaxROCE (%)Operating Margin (%)Net Margin (%)EPS Growth (%)

This row i want x axis it is possible Plz suggest me

 

 

Thank you

 

Greg_Deckler
Super User
Super User

Actually, if you have the April release, you could just use a Running Total Quick Measure. Right click your "Spend" column to create.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

I would start here:

http://www.daxpatterns.com/cumulative-total/

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors