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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
MasterSonic
Helper IV
Helper IV

2 columns with dates _ cumulative sum _ Combine 2 line charts

Hi guys,

Is there a way to combine 2 line charts - ??

 

I have 2 tables, 1st includes column Code (text type), 2nd Table have column TrackDate and SoldDate ( both Date types). Tables are linked with 3rd column.

I managed to build 2 seperate Line charts showing cumulative sum of dates as below

 

NewCode= CALCULATE(DISTINCTCOUNT('Table1'[Code])) 

10 = CALCULATE(SUM('Table1[NewCode]),'Table1'[Category]="Office") - to filter on Category

Cumulative  =
var Arr = SUM('Table1'[NewCode])
return
CALCULATE(
'Table1'[10],
FILTER(
ALLSELECTED('Table2'[TrackDate]),
'Table2'[TrackDate] <= MAX('Table2'[TrackDate]
))
)
Resulted in below. Second graph is created exacly the same just usign column SoldDate

MasterSonic_1-1660061937434.pngMasterSonic_2-1660061948100.png



Is there a way to combine these 2 lines, so they are both on one visual please ?? 🤓

 

ps. I also have calendar table but I can't make a use of it ( used instead of  Table2's columns, show fluctuations instead of cumulative rise)

Calendar 1 =
VAR Days = CALENDAR ( DATE ( 2016, 1, 1 ), DATE ( 2030, 12, 31 ) )
RETURN ADDCOLUMNS (
    Days,
    "Year", YEAR ( [Date] ),
    "Month Number", MONTH ( [Date] ),
    "Month", FORMAT ( [Date], "mmmm" ),
    "Year Month Number", YEAR ( [Date] ) * 12 + MONTH ( [Date] ) - 1,
    "Year Month", FORMAT ( [Date], "mmm yy" ),
    "Week Number", WEEKNUM ( [Date] ),
"Week Number and Year", "W" & WEEKNUM ( [Date] ) & " " & YEAR ( [Date] ),
"WeekYearNumber", YEAR ( [Date] ) & 100 + WEEKNUM ( [Date] ),
"Is Working Day",not WEEKDAY([Date]) in {1,7}
)

 

Thank You
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@MasterSonic , Join both dates with date table , one join will active another one will inactive

 

have two measures like

 

T10 = CALCULATE(SUM('Table1[NewCode]),filter('Table1', 'Table1'[Category]="Office") , userelationship('Date'[Date], 'Table1'[TrackDate])  )

 

T10 Sold= CALCULATE(SUM('Table1[NewCode]),filter('Table1', 'Table1'[Category]="Office") , userelationship('Date'[Date], 'Table1'[SoldDate])  )

 

Then cumulative like

 

Cumm = CALCULATE([T10],filter(allselected(date),date[date] <=max(date[date])))

 

Cumm = CALCULATE([T10 Sold],filter(allselected(date),date[date] <=max(date[date])))

 

or

 

Cumm = CALCULATE([T10],filter(all(date),date[date] <=max(date[date])))

 

Cumm = CALCULATE([T10 Sold],filter(all(date),date[date] <=max(date[date])))

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@MasterSonic , Join both dates with date table , one join will active another one will inactive

 

have two measures like

 

T10 = CALCULATE(SUM('Table1[NewCode]),filter('Table1', 'Table1'[Category]="Office") , userelationship('Date'[Date], 'Table1'[TrackDate])  )

 

T10 Sold= CALCULATE(SUM('Table1[NewCode]),filter('Table1', 'Table1'[Category]="Office") , userelationship('Date'[Date], 'Table1'[SoldDate])  )

 

Then cumulative like

 

Cumm = CALCULATE([T10],filter(allselected(date),date[date] <=max(date[date])))

 

Cumm = CALCULATE([T10 Sold],filter(allselected(date),date[date] <=max(date[date])))

 

or

 

Cumm = CALCULATE([T10],filter(all(date),date[date] <=max(date[date])))

 

Cumm = CALCULATE([T10 Sold],filter(all(date),date[date] <=max(date[date])))

 

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

You are Star

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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