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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Chetcork
Frequent Visitor

Display future dates

Hi everyone,

 

I'm trying to create line chart with two lines one for current data and one line for last year data. I have measures worked out and aswell date table. Date table is created using startdate and enddate from column of queried from sql server, data is refresed everyweek in sql server. Now back to the line chart, im trying to create line chart that will show all the months from 2022 and line representing current yearr data and as well last year data. I assume that future dates in datetable are necessary, but if you guys have any idea feel free to write. Please take a look on low quality picture below

 

 

Chetcork_0-1650397648805.png

 

1 ACCEPTED SOLUTION

Hi @Chetcork

 

Your assumption is correct that future dates in datetable are necessary. At least the datetable should have dates till the end of 2022. Then you can use measures like below and put them into the line chart. 

This Year = CALCULATE(SUM('Table'[Value]),'Date'[Year]=2022)
Last Year = CALCULATE(SUM('Table'[Value]),'Date'[Year]=2021)

vjingzhang_0-1650621041282.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Chetcork ,
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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

Hi,

 

I cannot share pbix file, but we can work on below sample data. I want line chart displaying only year 2022 from january to december that contains last year data and current data. Dates in my datetable are queried from sql therfore max date is forced on refresh of dataset

 

01.01.202125
01.02.202150
01.03.202113
01.04.202112
01.05.202167
01.06.202190
01.07.202132
01.08.2021120
01.09.202135
01.10.202111
01.11.202112
01.12.202190
01.01.202287
01.02.202228
01.03.202212
01.04.202212

Hi @Chetcork

 

Your assumption is correct that future dates in datetable are necessary. At least the datetable should have dates till the end of 2022. Then you can use measures like below and put them into the line chart. 

This Year = CALCULATE(SUM('Table'[Value]),'Date'[Year]=2022)
Last Year = CALCULATE(SUM('Table'[Value]),'Date'[Year]=2021)

vjingzhang_0-1650621041282.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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