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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Learn001
Regular Visitor

year to date plus 3 month future year sales target data

hello,

 

i need help i have 3 column of data: date whole yearof 2023,2024 and some of data 2025, and another of actual sales and the target sales data,

have the Year Slicer and a line and cluster column chart,

have dax to show the actual sales data using: Sales YtD = calculate(sum('SALE'),year('DATE'))

 

and how can i do for TARGET to show Year to Date data plus 3 month of future year? so in the chart i have data of a whole year to date 'TARGET' and 'SALE' data and see +3 month of 'TARGET' data? of course 'SALE' still blank for this future 3 month.

like this if in excel:

Screenshot 2025-01-08 154129.png

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

Hi,

Thanks for the solution rit_ty7  offered, and i want to offer some more information for user to refer to.

hello @Learn001 , you can refer to the following solution.

Sample data 

vxinruzhumsft_0-1736391152885.png

Create a calendar table.

Calendar = CALENDAR(DATE(2023,1,1),DATE(2025,12,31))

(there is no relationship between the tables)

Then create the following measures.

Volume YtD =
IF (
    ISFILTERED ( 'Calendar'[Date].[Year] ),
    CALCULATE (
        SUM ( PROD_CM_AP25[VOLPROD] ),
        YEAR ( PROD_CM_AP25[DATE] ) = MAX ( 'Calendar'[Date].[Year] )
    ),
    CALCULATE ( SUM ( PROD_CM_AP25[VOLPROD] ) )
)
Sale Target YtD =
VAR a =
    EOMONTH ( MAXX ( ALLSELECTED ( 'Calendar' ), [Date] ), +3 )
VAR b =
    MINX ( ALLSELECTED ( 'Calendar' ), [Date] )
RETURN
    CALCULATE (
        SUM ( PROD_CM_AP25[VOL SALES TARGET] ),
        FILTER ( PROD_CM_AP25, [DATE] >= b && [DATE] <= a )
    )

Then create a visual, and put the measures and the date field of the PROD_CM_AP25 to the visual.

vxinruzhumsft_1-1736391368220.png

Create a slicer and put the date of the calendar table to the slicer.

vxinruzhumsft_2-1736391463278.png

 

Output

vxinruzhumsft_3-1736391480148.png

Best Regards!

Yolo Zhu

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

11 REPLIES 11
v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution rit_ty7  offered, and i want to offer some more information for user to refer to.

hello @Learn001 , you can refer to the following solution.

Sample data 

vxinruzhumsft_0-1736391152885.png

Create a calendar table.

Calendar = CALENDAR(DATE(2023,1,1),DATE(2025,12,31))

(there is no relationship between the tables)

Then create the following measures.

Volume YtD =
IF (
    ISFILTERED ( 'Calendar'[Date].[Year] ),
    CALCULATE (
        SUM ( PROD_CM_AP25[VOLPROD] ),
        YEAR ( PROD_CM_AP25[DATE] ) = MAX ( 'Calendar'[Date].[Year] )
    ),
    CALCULATE ( SUM ( PROD_CM_AP25[VOLPROD] ) )
)
Sale Target YtD =
VAR a =
    EOMONTH ( MAXX ( ALLSELECTED ( 'Calendar' ), [Date] ), +3 )
VAR b =
    MINX ( ALLSELECTED ( 'Calendar' ), [Date] )
RETURN
    CALCULATE (
        SUM ( PROD_CM_AP25[VOL SALES TARGET] ),
        FILTER ( PROD_CM_AP25, [DATE] >= b && [DATE] <= a )
    )

Then create a visual, and put the measures and the date field of the PROD_CM_AP25 to the visual.

vxinruzhumsft_1-1736391368220.png

Create a slicer and put the date of the calendar table to the slicer.

vxinruzhumsft_2-1736391463278.png

 

Output

vxinruzhumsft_3-1736391480148.png

Best Regards!

Yolo Zhu

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

 

 

 

@v-xinruzhu-msft ,thank you, thank you very much, its work like a charm 😊

ryan_mayu
Super User
Super User

could you pls provide the sample data that generate the chart you provided?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu this is the data that been use:
Screenshot 2025-01-08 180152.png

we record in year and month for the report with format "mm/dd/yyyy'. day will always in 1st date.

how you get the data for 2025?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




rit_ty7
Advocate I
Advocate I

Hi @Learn001 ,

you should create a measure for total sales and then recall this measure in the place of sum(PROD_CM_AP25[Vol Sales Target])
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Ritesh Kumar,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@rit_ty7 , thank you again, the data show but still not show the +3 future month, and missing some data too

Chart 1.jpg

 

value i use as following dax for above report

 

Volume YtD = CALCULATE(SUM(PROD_CM_AP25[VOLPROD]),YEAR(PROD_CM_AP25[DATE]))
 
Volume LY = CALCULATE(SUM(PROD_CM_AP25[VOLPROD]),SAMEPERIODLASTYEAR(PROD_CM_AP25[DATE].[Date]))
 
Sale Target YtD =
VAR A = EDATE(MAX(PROD_CM_AP25[DATE]), 3)
VAR B = DATE(YEAR(A), 4, 1)
RETURN
CALCULATE(SUM(PROD_CM_AP25[VOL SALES TARGET]),
FILTER(ALL(PROD_CM_AP25[DATE]),PROD_CM_AP25[DATE] >= B && PROD_CM_AP25[DATE] <= A))
 
rit_ty7
Advocate I
Advocate I

Hello @Learn001 ,
you can try the below dax for calculating YTD plus 3 months,
YTD_3m =

var a = EDATE(MAX(DateTable[Date]), 3)
var b = DATE(YEAR(a), 4, 1)
RETURN
CALCULATE([Sale], FILTER(ALL('DateTable'[Date]), 'DateTable'[Date] >= b && 'DateTable'[Date] <= a))

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Ritesh Kumar,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@rit_ty7 thank you very much for quick response, i have try but still show some eror, did i miss something?

Screenshot 2025-01-08 163556.png

Hello @Learn001 ,
close the sum bracket before filter expression
Sale Target YtD =
VAR A = EDATE(MAX(PROD_CM_AP25[DATE]), 3)
VAR B = DATE(YEAR(A), 4, 1)
RETURN
CALCULATE(
SUM(PROD_CM_AP25[VOL SALES TARGET]),
FILTER(
ALL(PROD_CM_AP25[DATE]),
PROD_CM_AP25[DATE] >= B &&
PROD_CM_AP25[DATE] <= A
)
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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