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! Learn more

Reply
SivaReddy
Frequent Visitor

TOTALYTD is not working

I loaded factinternetsales from adventureworks2016 database into powerbi. created totalytd column using following dax formula.

 

TOTALYTD= TOTALYTD(sum(FactInternetSales[SalesAmount]),FactInternetSales[OrderDate].[Date])

 

the above dax is not working. please find the below screenshot.

 

SivaReddy_0-1629126765777.png

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @SivaReddy ,

 

Try this formula.

Measure = CALCULATE(SUM('Table'[sales]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(SELECTEDVALUE('Table'[date]))&&'Table'[date]<=MAX('Table'[date])))

4.PNG

 

Best Regards,

Jay

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @SivaReddy ,

 

Try this formula.

Measure = CALCULATE(SUM('Table'[sales]),FILTER(ALLSELECTED('Table'),YEAR('Table'[date])=YEAR(SELECTEDVALUE('Table'[date]))&&'Table'[date]<=MAX('Table'[date])))

4.PNG

 

Best Regards,

Jay

Samarth_18
Community Champion
Community Champion

Hi @SivaReddy ,

If you have calender table/date table which connected to FactInternetSales table  then pass date column from calender/date table into totalytd function.

TOTALYTD ( SUM ( FactInternetSales[SalesAmount] ), Calender_table[Date] )

or you can try below code:-

TOTALYTD =
CALCULATE (
    SUM ( FactInternetSales[SalesAmount] ),
    YEAR ( FactInternetSales[OrderDate] ) = YEAR ( NOW () )
)

 

Thanks, 

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

I used fulldatealternativekey of dimdate. Still I am not getting ytd. please find the below screenshot.

 

SivaReddy_0-1629213095737.png

dax formula used is TotalYTD = TOTALYTD(sum(FactInternetSales[SalesAmount]),DimDate[FullDateAlternateKey].[Date])

What about below code?

 

TOTALYTD =
CALCULATE (
    SUM ( FactInternetSales[SalesAmount] ),
    YEAR ( FactInternetSales[OrderDate] ) = YEAR ( NOW () )
)

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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