Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi All,
I have table like the below mentioned image. My requirement is count of emp_Id whoever is getting zero(0) value for last 3 month.
Kindly help me on this if anyone have any idea let me know.
@Arul @Greg_Deckler @amitchandak
Regards,
Ajith
Solved! Go to Solution.
So I created a MonthOrder table since you have the month in text and year (I suggest to improve that)
Then I created the following measure :
ZeroCountLast3Months =
VAR Last3MonthsTable =
TOPN(
3,
SUMMARIZE(
'Data',
'Data'[Month],
"MonthOrder", CALCULATE(MAX('MonthOrder'[MonthOrder]))
),
[MonthOrder], DESC
)
VAR Last3Months = SELECTCOLUMNS(Last3MonthsTable, "Month", [Month])
VAR EmployeesWithZerosLast3Months =
SUMMARIZE(
FILTER(
'Data',
'Data'[Month] IN Last3Months && 'Data'[Value] = 0
),
'Data'[EMP_ID],
"ZeroCount", COUNTROWS('Data')
)
RETURN
COUNTROWS(
FILTER(EmployeesWithZerosLast3Months, [ZeroCount] = 3)
)
There is one Employee E that matches your condition
So I created a MonthOrder table since you have the month in text and year (I suggest to improve that)
Then I created the following measure :
ZeroCountLast3Months =
VAR Last3MonthsTable =
TOPN(
3,
SUMMARIZE(
'Data',
'Data'[Month],
"MonthOrder", CALCULATE(MAX('MonthOrder'[MonthOrder]))
),
[MonthOrder], DESC
)
VAR Last3Months = SELECTCOLUMNS(Last3MonthsTable, "Month", [Month])
VAR EmployeesWithZerosLast3Months =
SUMMARIZE(
FILTER(
'Data',
'Data'[Month] IN Last3Months && 'Data'[Value] = 0
),
'Data'[EMP_ID],
"ZeroCount", COUNTROWS('Data')
)
RETURN
COUNTROWS(
FILTER(EmployeesWithZerosLast3Months, [ZeroCount] = 3)
)
There is one Employee E that matches your condition
Try the below,
1. Created a calculated column for the dates using the below code,
FirstDayOFMonth = DATEVALUE('Table'[MONTH]&"-"&'Table'[YEAR])
2. Try the below measure for employees count those have values zero for last 3 month.
Count Of Employee Id =
VAR _date =
MONTH(MAX('Table'[FirstDayOFMonth]))
VAR _currentMonth =
FILTER(
'Table',
MONTH('Table'[FirstDayOFMonth]) = _date &&
'Table'[VALUE] = 0)
VAR _previousMonth =
FILTER(
'Table',
MONTH('Table'[FirstDayOFMonth]) = _date-1 &&
'Table'[VALUE] = 0)
VAR _monthBeforePrevious =
FILTER(
'Table',
MONTH('Table'[FirstDayOFMonth]) = _date-2 &&
'Table'[VALUE] = 0)
VAR _allTogether = EXCEPT(EXCEPT(_currentMonth,_previousMonth),_monthBeforePrevious)
RETURN COUNTROWS(_allTogether)
I am getting count as 1 for the sample data provided, however can you check and confirm whether it is working as expected.
No, only Month and Year column.
| User | Count |
|---|---|
| 51 | |
| 38 | |
| 33 | |
| 22 | |
| 19 |
| User | Count |
|---|---|
| 136 | |
| 101 | |
| 58 | |
| 36 | |
| 35 |