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!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi All,
We selected following filter on "Years" ( 2023, 2021 ) Comparing data of 2023, 2021 and looking only YTD data only.
Current year 2023 Date: 24-JAN-2023
Comparing Year 2021 : 24-JAN-2021
We would like to display QTY result on visual only YTD meaning 2021 QTY data only up to 24-Jan-2021 and 2023 QTy Data upto 24-Jan-2023.
At present for yer 2021 it display complete 2021 years data.
Can any one please suggest DAX formula to get data of 2021 and 2023 between 01-JAN and 24-JAN.
Thanks,
MS
Try
YTD QTY =
VAR SelectedYear =
SELECTEDVALUE ( 'Date'[Year] )
VAR YearsToSubtract =
SelectedYear - YEAR ( TODAY () )
RETURN
CALCULATE (
SUM ( 'Table'[Quantity] ),
DATEADD ( DATESYTD ( 'Date'[Date] ), YearsToSubtract, YEAR )
)
Hi,
I tried and getting only result of 2023 year and not for year 2021.
If I select year 2021 and 2022 it should calculate result of full year of ( 2021 and 2022).
In my selection (2021 and 2023) getting in correct result.
By selecting year 2023 and 2021 it should calculate only YTD, ( Period JAN and day between 01 and day 24 ) for year ( 2021, 2023).
Thanks
MS
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |
| User | Count |
|---|---|
| 26 | |
| 22 | |
| 19 | |
| 17 | |
| 10 |