Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
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
Solved! Go to 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)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
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.2021 | 25 |
01.02.2021 | 50 |
01.03.2021 | 13 |
01.04.2021 | 12 |
01.05.2021 | 67 |
01.06.2021 | 90 |
01.07.2021 | 32 |
01.08.2021 | 120 |
01.09.2021 | 35 |
01.10.2021 | 11 |
01.11.2021 | 12 |
01.12.2021 | 90 |
01.01.2022 | 87 |
01.02.2022 | 28 |
01.03.2022 | 12 |
01.04.2022 | 12 |
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)
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.