Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I have an YTD line in a graph. I want it to be limited to February 2021, as I only have data until that point of time.
My DAX looks like this:
Thank you.
Best Regards,
Daniel
Solved! Go to Solution.
@hilmer101 Please try below solution
Create a measure:
This measure is used to determine whether the currently selected date is greater than the maximum date in the fact table, that is, whether the currently selected date is in the future.
ShowValueForDates =
VAR _LastDateWithData = -- calculate the maximum date in your fact table
CALCULATE (
MAX ( 'MF_MB51'[Posting Date] ),
REMOVEFILTERS ()
)
VAR _FirstDateVisible =
MIN ( 'MD_Date'[Date] )
VAR _Result =
_FirstDateVisible <= _LastDateWithData
RETURN
_ResultThen Put the measure in your YTD calculation.
MVTYTD.DYN =
IF(
[ShowValueForDates] ,
CALCULATE( [MVTQTY.DYN] ,
DATESYTD( 'MD_Date'[Date] )
)
)@hilmer101 Please try below solution
Create a measure:
This measure is used to determine whether the currently selected date is greater than the maximum date in the fact table, that is, whether the currently selected date is in the future.
ShowValueForDates =
VAR _LastDateWithData = -- calculate the maximum date in your fact table
CALCULATE (
MAX ( 'MF_MB51'[Posting Date] ),
REMOVEFILTERS ()
)
VAR _FirstDateVisible =
MIN ( 'MD_Date'[Date] )
VAR _Result =
_FirstDateVisible <= _LastDateWithData
RETURN
_ResultThen Put the measure in your YTD calculation.
MVTYTD.DYN =
IF(
[ShowValueForDates] ,
CALCULATE( [MVTQTY.DYN] ,
DATESYTD( 'MD_Date'[Date] )
)
)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 |
|---|---|
| 5 | |
| 5 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 21 | |
| 12 | |
| 10 | |
| 8 |