Forum Discussion
Anonymous
3 years agoNot applicable
How to Count Slicer Items
Hello Supporting Community, Here is the Dropbo File https://www.dropbox.com/s/l90npr8j6xllhcn/Employe_Count.pbix?dl=0 I am need to count the Employs, if from Category slicer any item is select...
- 3 years ago
Hi Anonymous I don't know if I understood you correctly, but look at the file.
Michael_Hall
3 years agoRegular Visitor
There is a simple solution. You are not wanting your measure to be sliced by the dates in the visual. Therefore, just create a new calendar that is disassociated from everything and use its dates in the visual.
1. Modeling > New table
Calendar = CALENDAR(DATE(2019,1,1), DATE(2025,12,31))
2. Replace the date in the x-axis of your visual with this one.
3. You can limit the range of the x-axis to your slicer's range using visualizations > format visual > range > minimum/maximum
Now you have a chart with two straight lines (6 for total and 5 for emp_Count).
I assume you want some other data in the chart. You can make measures to refer to your new calendar. For example:
Emp_Count for date =
VAR the_date = SELECTEDVALUE('Calendar'[Date])
RETURN
CALCULATE(DISTINCTCOUNT(EmployCount[Employ]),
EmployCount[Date_Range] = the_date)
Or equivalently:
Emp_Count for date =
CALCULATE(DISTINCTCOUNT(EmployCount[Employ]),
TREATAS(VALUES('Calendar'[Date]), EmployCount[Date_Range]))
Result: