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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
CJANE
Helper I
Helper I

Prior Year to Date - No Date Table

I am trying to create an expression to show total sales for prior YTD.  My Sales and Date are in the same table.  I do not have a separate date table.  Is there an expression that will work for this scenario?

 

Table Name is Trades

 

Fields are Gross Amount and Trade Date

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @CJANE 

You can create a Measure like the following.

 

LYTD =

var year=YEAR(MAX(Trades[Trade Date]))-1

return CALCULATE(SUM(Trades[Gross Amount]), FILTER(ALL(Trades),Trades[Trade Date]>=DATE(year,1,1)&&Trades[Trade Date]<=MAX(Trades[Trade Date])))

 

The result looks like this:

v-cazheng-msft_0-1616753647415.png

 

For more details, you can refer the attached pbix.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @CJANE 

You can create a Measure like the following.

 

LYTD =

var year=YEAR(MAX(Trades[Trade Date]))-1

return CALCULATE(SUM(Trades[Gross Amount]), FILTER(ALL(Trades),Trades[Trade Date]>=DATE(year,1,1)&&Trades[Trade Date]<=MAX(Trades[Trade Date])))

 

The result looks like this:

v-cazheng-msft_0-1616753647415.png

 

For more details, you can refer the attached pbix.

 

Best Regards

Caiyun Zheng

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

MattAllington
Community Champion
Community Champion

You should not write any time intelligence function without a date table. The reason is that the time intelligence functions rely on a complete list of all days in the table to work. You can use the inbuilt date table if you like. Simply refer to it in locations where you must specify the date column, ie SAMEPERIODLASTYEAR(Trades[Date].[Date]). Note the extra .[Date]



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.
themistoklis
Community Champion
Community Champion

@CJANE 

 

Try any of the following 2 formulas:

LYTD = CALCULATE(SUM(Trades[Gross Amount]), SAMEPERIODLASTYEAR(Trades[Trade Date]))
LYTD = CALCULATE(SUM(Trades[Gross Amount]), DATEADD (Trades[Trade Date], -1, YEAR))

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.