Forum Discussion
slicer selected choice
Hi to all,
I am trying to change dynamically a measure coherently with the value of a year slicer, but this is not working properly.
I have a:
- Year slicer with the column of a Table1 "Table1[Year]" which may have two years 2020, 2021
- measure on a Table2 which should be dependent on that slicer. I have tryed with three different solutions:
Sol1: This is working.... but it is not dynamically dependent on the slicer!
CALCULATE(SUM(Table2[Counter]),
If(SELECTEDVALUE(Table1[YEAR])=2020,
CALCULATE(SUM(Table2[Counter]),
CALCULATE(SUM(Table2[Counter]),
CALCULATE(SUM(Table2[Counter]),
Any hints?
gunicotra , This kind of measure is suitable if table 1 and table 2 are not connected
measure =
var _year = allselected(Table[Year])
return
CALCULATE(SUM(Table2[Counter]),filter(Table2 , Table2[CODE] in {"10", "11", "12","13","14"} && 'Table2'[YEAR] in _year))because if they are connected , it will already have filter impact
I explained it here
Need of an Independent Table in Power BI: https://youtu.be/lOEW-YUrAbE
3 Replies
- amitchandak
Super User
gunicotra , This kind of measure is suitable if table 1 and table 2 are not connected
measure =
var _year = allselected(Table[Year])
return
CALCULATE(SUM(Table2[Counter]),filter(Table2 , Table2[CODE] in {"10", "11", "12","13","14"} && 'Table2'[YEAR] in _year))because if they are connected , it will already have filter impact
I explained it here
Need of an Independent Table in Power BI: https://youtu.be/lOEW-YUrAbE
- gunicotra
Helper II
great solution! it works perfectly. Thanks 🙂
- gunicotra
Helper II
N.B.: "ANNO_CAMPAGNA" means "YEAR"