We're giving away 30 tickets for FREE! Share your story, your vision, or your hustle and tell us why YOU deserve a ticket.
Apply nowWin a FREE 3 Day Ticket to FabCon Vienna. Apply 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
_Result
Then 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
_Result
Then Put the measure in your YTD calculation.
MVTYTD.DYN =
IF(
[ShowValueForDates] ,
CALCULATE( [MVTQTY.DYN] ,
DATESYTD( 'MD_Date'[Date] )
)
)
User | Count |
---|---|
13 | |
12 | |
8 | |
8 | |
6 |
User | Count |
---|---|
28 | |
19 | |
13 | |
11 | |
7 |