Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
Solved! Go to Solution.
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])))
Best Regards,
Jay
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])))
Best Regards,
Jay
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.
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
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 41 | |
| 38 | |
| 36 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 128 | |
| 88 | |
| 79 | |
| 67 | |
| 62 |