March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello All,
I am new to Power BI. I am preapring dashboard for Overtime calculation.
I am having huge data and i am able to display full month data without error because there i am just add few columns and displaying Total Overtime.
But when it comes to Current month or partial month data then i am need to calculate Estimated Overtime for remaining working days excluding saturdays.
Sample of Excel is,
Date | ID | ActualTime | HolidayOvertime | InTime | OutTime |
20190601 | 1997037 | 0 | 0 | 0 | 0 |
20190602 | 1997037 | 0 | 0 | 0 | 0 |
20190603 | 1997037 | 4.2 | 0 | 803 | 1845 |
20190604 | 1997037 | 3.4 | 0 | 803 | 1744 |
20190605 | 1997037 | 3.7 | 0 | 803 | 1753 |
20190606 | 1997037 | 4.6 | 0 | 823 | 1911 |
20190607 | 1997037 | 4.2 | 0 | 821 | 2011 |
20190608 | 1997037 | 0 | 0 | 0 | 0 |
20190609 | 1997037 | 0 | 0 | 0 | 0 |
20190610 | 1997037 | 4.6 | 0 | 823 | 1826 |
20190611 | 1997037 | 3.2 | 0 | 822 | 1734 |
20190612 | 1997037 | 0 | 0 | 823 | 2043 |
20190613 | 1997037 | 4.1 | 0 | 822 | 2049 |
20190614 | 1997037 | 4.2 | 0 | 836 | 1800 |
20190615 | 1997037 | 0 | 0 | 0 | 0 |
I have imported this excel file to PowerBI and it created Excel name as Table name.
Then i have created Calendar table for calculating total weekends count.
I have created two calculated columns for calculating Saturdays in month and Sundays in month.
Measure is >> WeekendsInMonth = SUMX('Calendar', 'Calendar'[SaturadaysInMonth] + 'Calendar'[SundaysInMonth] )
WeekendsInMonth column is having count of weekends in each month.
Then i have created few Measures and Calculated columns for Getting Worked days count of the month, Total Overtime, Holidays, Worked average overtime etc in Excel Table.
TotalOvertime (Measure) = SUMX('sample', 'sample'[ActualOvertime] + 'sample'[HolidaysOvertime] )
WkdDaysOfMonth (Calculated column)= IF('sample'[InTime]<>0 && 'sample'[OutTime]<>0, 1 , 0)
WrkdAvgOvertime (Measure)= DIVIDE('sample'[TotalOvertime]/ SUM('sample'[WkdDaysOfMonth ]))
TotalDaysInMonth (Measure)= TotalDaysInMonth = DAY(ENDOFMONTH('Calendar'[Date].[Date]))
TotalHolidays (Measure) = Here i am adding Employee taken leaves and Company Holidays and both are calculated columns
EstdWkgDaysOfMonth (Measure) = 'sample'[TotalDaysInMonth ] - SUMX('sample', 'sample'[WkdDaysOfMonth] + 'sample'[WeekendsInMonth] + 'sample'[TotalHolidays])
EstdWorkingOvertime (Measure) = 'sample'[EstdWkgDaysOfMonth] * 'sample'[WrkdAvgOvertime ]
Excel file has Date column which is type of Number then i have created new Calculated column for as below,
FormattedDate = IFERROR( DATE(LEFT('sample'[Date],4),MID('sample'[Date],5,2),RIGHT('sample'[Date],2)), DATE("yyyy","mm","dd"))
Then i have given relationship as Many-to-one in Model view.
For Full month data i am just showing TotalOvertime in Stacked bar.
For partial month i am showing TotalOvertime in Blue bar and remaining estimated overtime in Orange bar.
But this remaining estimated overtime i am showing properly but it contains saturdays and sundays count. I am trying to show only reamining working days excluding weekends.
i thing here it is considering weekends count for data the data present in excel file. It is taking whole weekends count in month.
I have shown in image below,
I have explained error and description in image also.
I think it is considering weekends count upto the date present in the Excel file. So how can i remove total weekends count from remaining working days.
Kindly help me on this issue.
Regards,
Amar
Perhaps this will help: https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/td-p/367362
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |