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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Formula To Retrieve Data from Last Year Month In Same Column

Hi 

 

I currently have a clustered column chart as follows. Capture.PNG

 

 

 

 

 

 

 

 

- The measure used has data dating back to 2016. 

- The green bar is Last year figure ie July 2017 August 2017 etc and the blue bar is this years figure. 

- The database still has not yet been fed through the data for this year for November 2018 or December 18 or so forth. 

 

Is there anyway to create something/measure/column so that even though the data for this year hasnt fed through it could still show last years figure?

 

The figure would have to be retreived from the same column. In other words the columns of data are as follows (Eg Numbers). As you can see from the table below the data for nov-18 still hasnt shown up. However I still want the graph to display LY figure from this column 

Capture.PNG

 

 

8 REPLIES 8
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please link the data table to a date dimention table. Add [Date] field from date dimention table onto chart X-axis, rather than from data table. Then, to calculate the value of previous year, please try below measure:

LY = CALCULATE(SUM(DataTable[Value]),SAMEPERIODLASTYEAR('dim date'[Date]))
Best regards,
Yuliana Gu
Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana,

 

Thanks! This did half the job

 

I would want the figure to show up under the November 2018 section and not show up in the November 2017 section?

 

If that makes any sense. 

Hi @Anonymous,

 

You could apply a visual level filter to the chart. 

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana,

 

I dont seem to have the option of relative date filtering?

Hi @Anonymous,

 

Select the chart visual, what can you see in the drop down list?

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Yuliana 

 

The options i have are as below

Untitled.png

Hi @Anonymous,

 

Please make sure the [date] field added to visual is formatted as date, rather than date hierarchy. Please check the difference from below screenshots.

1.PNG             2.PNG

3.PNG    4.PNG

 

Best regards,

Yuliana Gu

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

@Anonymous

 

Can you try this:

Total Sales LY = 
VAR MaxDate = EDATE(CALCULATE(MAX(TODAY()), ALL(TableName)),-12)
RETURN
CALCULATE(
    SUM(TableName[Value]),
    FILTER(SAMEPERIODLASTYEAR('TableName'[Date]),'TableName'[Date]<=MaxDate)  
)

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors