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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Clara
Advocate II
Advocate II

Same period each year in chart? (Timeline Slicer + Line Chart)

Hello all!
I am using a Timeline Slicer through a calendar table to extract the total of sales in a measure I have called "SumSalesTY":

 

 

SumSalesTY = 
VAR LimMin = FIRSTDATE(Calendar[MonYear])
VAR LimMax = LASTDATE(Calendar[MonYear])

RETURN CALCULATE(
SUM(Table1[Sales]),
ALLEXCEPT(Table1,Table1[Date],Table1[Unit]),
Table1[Date]>=LimMin,
Table1[Date]<=LimMax
)

It works well in a card visual, but I'm stuck as to how I can use it in a line chart.

Here's how my report looks so far:

 

reality.png

 

 

The timeline slices through Calendar[MonYear] and is filtered to show only the "last" 24 months (actually jan-dec 2018 and 2019).

The yellow chart is only showing the sales total for Mar-Apr/2019, but actually I wanted it to show previous years as well (sales total for march+april each year):

 

expectation.png

 

How would I achieve that?

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Clara 

 

You may apply virtual relationship in DAX measure.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks @v-chuncz-msft , but how would I do that? My timeline slices through Calendar[MonYear], which is (indirectly, I guess?) in a real relationship with Table1[MonYear]. (I say indirectly because in fact, I've linked Calendar[Date] with Table1[Date], though both tables also have "MonYear" columns.)

 

I can attest that the relationship works because I've checked that 5.3 M really is the total of sales for March+April 2019 (as in the example above).

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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