Forum Discussion
Getting selected Month from a slicer
- 2 years ago
Did you create a measure? From your file:
Your screenshot shows a summarized column, not a measure.
Hi yousef_alsalem ,
- make sure you use 'Months'[MonthName] in the slicer
- try rewrite the measure:
EmpCount =
var mon = SELECTEDVALUE('Months'[MonthName])
VAR data =
CALCULATE(
COUNT(MainData[Employee Id]),
MainData[Business Unit] = Joiners[Business Unit],
MainData[Hiring Month] = mon
)
RETURN data
- yousef_alsalem2 years agoNew Member
Thanks for the reply but it give me an error, cannot find name Business Unit
The expression contains columns from multiple tables, but only columns from a single table can be used in a True/False expression that is used as a table filter expression.
I'm sure that I use 'Months'[MonthName] in the slicer
I belive that my code main issue in getting the selected value from the slicer not filtring the data.- ERD2 years agoCommunity Champion
Oh, sorry, indeed, it will give an error since it's a measure. Try this:
EmpCount = var mon = SELECTEDVALUE('Months'[MonthName]) VAR data = CALCULATE( COUNT(MainData[Employee Id]), MainData[Business Unit] = SELECTEDVALUE(Joiners[Business Unit]), MainData[Hiring Month] = mon ) RETURN data- yousef_alsalem2 years agoNew Member
Theres is no slice for the business unit.
In the next step I will have to add more filters, like by year and quarter etc.
I have added a dummy file at the end of my post.