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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Sleathbcn
Regular Visitor

Problem measure reaching previous year goal

Hello, I need help creating a DAX measure.

 

I have 2 measures created, "Total Sales" = current sales and "LY Sales" = previous year sales.

I have doubled the "LY Sales" measure under the "Target" name.

I need to create a measure that tells me the amount left to reach the Target.

For example. If the sales for the year 2024 were $100,000 and I am closing the month of January 2025 and my sales are $15,000,

I would like the measure to indicate ($100,000 - $15,000) = ("Target" - "Total Sales"), based on the closing date in my calendar filter, for example January 31, 2025, until you reach the goal. In this case $85,000

 

In short, what it is about is that in each month of the end of the current year, I can see what I have left until I reach the figure from the previous year, which is what I take as my Target.

Thks a lot,

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Sleathbcn 


Target Sales  =  CALCULATE ( [Total Sales], PARALLELPERIOD ( 'Date'[Date], -1, YEAR ) )
Remaining Sales =  [Target Sales] - TOTALYTD ( [Sales Amount], 'Date'[Date] )

Add Year Month on a table visual and these two measures to see the results.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Sleathbcn ,

Thanks for Fowmy's reply!
And @Sleathbcn , Since I don't know what your data looks like, and I don't know how your existing measures [Total Sales] and [LY Sales] were created, I created sample data and these two DAXs myself to give you a reference:

vjunyantmsft_0-1738137473319.png

LY Sales = 
SUMX (
    FILTER ( ALL ( Sales ), YEAR ( 'Sales'[Date] ) = YEAR ( TODAY () ) - 1 ),
    'Sales'[Sales]
)
Target = 2 * [LY Sales]
Total Sales = 
CALCULATE(
    SUM(Sales[Sales]),
    ALL(Sales),
    'Sales'[Date] <= MAX('Sales'[Date]) && YEAR('Sales'[Date]) = YEAR(TODAY())
)
Distance from target = 
IF(
    YEAR(MAX('Sales'[Date])) = YEAR(TODAY()),
    [Target] - [Total Sales],
    BLANK()
)

And the final output is as below:

vjunyantmsft_1-1738137585076.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@Sleathbcn 


Target Sales  =  CALCULATE ( [Total Sales], PARALLELPERIOD ( 'Date'[Date], -1, YEAR ) )
Remaining Sales =  [Target Sales] - TOTALYTD ( [Sales Amount], 'Date'[Date] )

Add Year Month on a table visual and these two measures to see the results.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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