Forum Discussion
bkr
2 years agoHelper I
Dynamic column based on slicer
Hi all, I have a list of products with its launch date (when it was introduced) and the type of introduction, whether it is replacement of an existing product or supports additional growth: ...
Daniel29195
2 years agoCommunity Champion
OUTPUT :
step1 :
create a calculated table, with the added "old" row.
step2 :
link the new created table to product table
step 3 :
create the slicer as below :
step 4 :
create the measure :
Measure 3 =
var t = VALUES(product_type[Type])
var y = year(MAX(dimdate[Date]))
var ad =
ADDCOLUMNS(
t,
"sales" ,
SWITCH(
TRUE(),
SELECTEDVALUE(product_type[Type]) = "Old" ,
CALCULATE(
SUM(factsales[Sales]),
factsales[Year] <= y , REMOVEFILTERS(product_type[Type])
)
,
CALCULATE(SUM(factsales[Sales]))
)
)
RETURN
SUMX(
ad,
[sales]
)
Let me know if it works for you .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠