Forum Discussion
Getting selected Month from a slicer
Hi,
I have issue with getting the selected value from a drop down list slicer.
I have a mesure in the Months table to catch the select value in the slicer
But this is not working
To test the code, this is working
File : Turnover_dummy.pbix
Did you create a measure? From your file:
Your screenshot shows a summarized column, not a measure.
10 Replies
- ERDCommunity Champion
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_alsalemNew 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.- ERDCommunity 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
- FowmySuper User
yousef_alsalem
Have you created the required relationship between the tables?
Sharing a dummy Power BI file representing your scenario would be beneficial. You can save the Power BI file on Google Drive or any other cloud storage platform and provide the link here. Kindly ensure that permission is granted to open the file.- yousef_alsalemNew Member
Hi,
Linking the table in a relationship is not what I want, because this is part of a bigger project and some tables have no realtions. In the next step I will have to add more filter, like by year and quarter etc.
I have added a dummy file at the end of my post.Thank you