Hello all,
I have a very simple table date, product code, units and have created a running total measure that allows me , when dropped into a pivot
table to retain all of the product I'd 's while only returning a running total for one, in this case 'a' .
<
abc :=
VAR mdate =
MAX ( Table1[Date] )
RETURN
IF (
CALCULATE (
SUM ( Table1[Units] ),
KEEPFILTERS ( Table1[Product] = "a" ),
FILTER (
ALL ( Table1[Date] ),
Table1[Date] <= mdate
&& Table1[Date] > EOMONTH ( mdate, -1 ) (so if true use)
)
),
VAR mdate =
MAX ( Table1[Date] )
RETURN
CALCULATE (
SUM ( Table1[Units] ),
KEEPFILTERS ( Table1[Product] = "a" ),
FILTER (
ALL ( Table1[Date] ),
Table1[Date] <= mdate
&& Table1[Date] > EOMONTH ( mdate, -1 ) (and if not return , I was hoping for a blank but get zero's)
)
),
" "
)
Now rather than having to type all out twice I'd like to write it once as a variable, so I could just then say ; if ( Vname, Vname, "" )
I've tried putting both variables at the start, and even pasted into "daxformatter.com' which is AMAZING, but not luck.
Richard.
I have a very simple table date, product code, units and have created a running total measure that allows me , when dropped into a pivot
table to retain all of the product I'd 's while only returning a running total for one, in this case 'a' .
<
abc :=
VAR mdate =
MAX ( Table1[Date] )
RETURN
IF (
CALCULATE (
SUM ( Table1[Units] ),
KEEPFILTERS ( Table1[Product] = "a" ),
FILTER (
ALL ( Table1[Date] ),
Table1[Date] <= mdate
&& Table1[Date] > EOMONTH ( mdate, -1 ) (so if true use)
)
),
VAR mdate =
MAX ( Table1[Date] )
RETURN
CALCULATE (
SUM ( Table1[Units] ),
KEEPFILTERS ( Table1[Product] = "a" ),
FILTER (
ALL ( Table1[Date] ),
Table1[Date] <= mdate
&& Table1[Date] > EOMONTH ( mdate, -1 ) (and if not return , I was hoping for a blank but get zero's)
)
),
" "
)
Now rather than having to type all out twice I'd like to write it once as a variable, so I could just then say ; if ( Vname, Vname, "" )
I've tried putting both variables at the start, and even pasted into "daxformatter.com' which is AMAZING, but not luck.
Richard.