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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.