Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello Team,
I have a requirement in Power BI. I have a table having Employee ID and each Employee having Work Hours information month wise.
I want to display the users who are having less than 6hours average work time for consecutive 3months based on the month selection in the slicer. Need your help to write the DAX formula to acheive this. One sample example is given below.
Emp ID | Work Time | Month |
1 | 5 | Jan |
2 | 8 | Jan |
3 | 9 | Jan |
1 | 4 | Feb |
2 | 7 | Feb |
3 | 6 | Feb |
1 | 4 | Mar |
2 | 4 | Mar |
3 | 5 | Mar |
In the above if you look at the work time value for Emploee ID 1 who is less than 6 hours for Jan, Feb and March months.
I need to display those employee ID with Work hours value for last 3 months. Any help would be highly appreciated.
Regards,
Sagar
Solved! Go to Solution.
Hi @sagarsahoo_123 ,
Try formula like below:
avg_ =
VAR avg_ =
AVERAGEX (
FILTER ( ALL ( 'Table' ), 'Table'[Emp ID] = MAX ( 'Table'[Emp ID] ) ),
CALCULATE ( SUM ( 'Table'[Work Time] ) )
)
RETURN
IF ( avg_ < 6, "Yes", "No" )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @sagarsahoo_123 ,
Try formula like below:
avg_ =
VAR avg_ =
AVERAGEX (
FILTER ( ALL ( 'Table' ), 'Table'[Emp ID] = MAX ( 'Table'[Emp ID] ) ),
CALCULATE ( SUM ( 'Table'[Work Time] ) )
)
RETURN
IF ( avg_ < 6, "Yes", "No" )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@sagarsahoo_123 , I have this video, in the logic, you add your condition of <6 , which should work
Power BI- Customer Purchasing in each of the last 3 months: https://youtu.be/bGtjoccEA38
User | Count |
---|---|
75 | |
74 | |
44 | |
31 | |
27 |
User | Count |
---|---|
99 | |
89 | |
52 | |
48 | |
46 |