Forum Discussion
bilalkhokar73
5 years agoHelper IV
Dynamic Measure(Year Till date)
In clustered Graph I want to display a single measure which will show me sales of 2019 ,2020 & 2021. here I need sales till date this year , till date last year and till date last to last year so Th...
- 5 years ago
bilalkhokar73
Can you try it:MEASUREYEARTILL = VAR __lastsalesdate = CALCULATE(MAX(sales[datei] ),REMOVEFILTERS()) VAR day1 = DAY(__lastsalesdate) VAR MONTH1 = MONTH(__lastsalesdate) VAR __filterdate = DATE(MAX (tm_date[year_id]), MONTH1, day1 ) RETURN CALCULATE ( SUM(sales[amt]), tm_date[Date] <= __filterdate, REMOVEFILTERS ( tm_date), VALUES (tm_date[year_id] ) )
bilalkhokar73
5 years agoHelper IV
I used thsi one but i got an error that
Calculation error in measure 'sales'[MEASUREYEARTILL]: An argument of function 'DATE' has the wrong data type or the result is too large or too small.
MEASUREYEARTILL =
VAR __lastsalesdate=CALCULATE(MAX(sales[datei] ),REMOVEFILTERS())
VAR day1=DAY(LASTDATE(sales[datei]))
VAR MONTH1=MONTH(__lastsalesdate)
VAR __filterdate = DATE(MAX (tm_date[Date] ), MONTH1, day1 )
RETURN
CALCULATE (SUM(sales[amt]),
tm_date[Date] <= __filterdate,
REMOVEFILTERS ( tm_date),
VALUES (tm_date[year_id] )
)
bilalkhokar73
5 years agoHelper IV
Fowmy It's working , made my day , thank you , appreciate