Friday, March 31, 2023
Storms in Pursuit
Wednesday, March 29, 2023
Sequencing Months and Years in Power BI
Sequencing months within Power BI can be a bit awkward, if you need to constantly shift months to show a rolling 12 or however many, while continually keeping them in the order in which they fall across years.
Solutions of the complex variety abound. Simple answers are rare, likely because most of the folks writing them have been mired in code for entirely too long. That is not to say they are wrong, just that there appears a tendency towards over-programming.
A simple solution only requires a little bit of math to produce results perfectly adapted to ordering months and their associated years in visualizations.
It can be done with or without a calendar dataset; either way, a date field is required.
In Power Query, add a [Year] and [Month] columns, both of the numeric variety.
The next step is to simply add a Custom Column with the following, which is M language, indicating to take the date and convert it to text and concatenate the two.
= Text.Combine({Date.ToText([#”Date”], “yyyy”), “ “, Date.ToText([#”Date”], “MMM”)})
The output in the new column is “2023 Mar” for March 2023.
Lastly, create one more Custom Column with the following code (M again).
=[Year]*100+[Month]
The output in the new column is “202303” for March 2023.
Mission accomplished, almost.
Back in Power BI, sort one column by the other and all months from here into eternity are sorted correctly by year and month.
Compare that with a DAX solution captured from somewhere a few months ago, hailed in some parts of the interweb as the greatest thing since sliced bread. It works just as well, relying on the same columns, but for non-programmer types is not quite as easy to wrap your head around, much less remember it over and over again.
Seq Month =
VAR MaxMos = SUMMARIZE(ALL(‘Calendar’),’A Calendar’[Year],”MaxMonth”,MAX(‘Calendar’[Month]))
VAR MyYear = [Year]
VAR MyStart = SUMX(FILTER(MaxMos,[Year]<MyYear),[MaxMonth])
VAR firstYear = CALCULATE(FIRSTNONBLANK(‘Calendar’[Year],1),ALL(‘Calendar’))
VAR myNum = IF(MyYear=firstYear,[Month],MyStart+[Month])
RETURN myNum
There are likely limitations with the simple approach, though none have been uncovered as of this writing. Power BI can slice and dice in a hundred different ways and seems to care very little whether the code is complex or simple math.
I like simple.
General Events Report
The General Events report monitors General Event Reports (GERs) and associated Medication Errors across Community Living programs. It helps leadership identify event trends, monitor compliance with reporting and approval requirements, review medication-error activity, evaluate event outcomes, and support interdisciplinary team (IDT) review processes.
GER Summary
The GER Summary page serves as the primary executive dashboard for monitoring General Event Reports. It provides a high-level overview of event activity, event types, compliance metrics, and reporting trends across the organization.
The page allows users to:
- Review overall General Event Report activity.
- Monitor event trends over time.
- Analyze event types and event distributions.
- Monitor reporting compliance.
- Review event activity by program.
GER Detail
The GER Detail page serves as the detailed review page for General Event Reports. It provides record-level information for individual events and supports investigation and follow-up activities.
The page allows users to:
- Review individual event records.
- Analyze event details by individual, program, and event type.
- Investigate open and resolved events.
- Support event follow-up activities.
Med Error Summary
The Med Error Summary page serves as the primary monitoring page for medication errors reported through the GER process. It provides a summarized view of medication-error activity and trends.
The page allows users to:
- Review medication-error trends.
- Analyze medication errors by type.
- Monitor medication-error frequency.
- Evaluate medication-error patterns over time.
Med Error Detail
The Med Error Detail page serves as the detailed investigation page for individual medication-error events. It supports quality assurance review and corrective-action activities.
The page allows users to:
- Review individual medication-error records.
- Analyze medication-error causes.
- Investigate event circumstances and outcomes.
- Support quality improvement efforts.
Influence on GER
The Influence on GER page serves as the report's analytical page for identifying factors associated with General Event Reports. It uses Key Influencers analysis to help users understand patterns and contributors associated with event activity.
The page allows users to:
- Identify factors associated with GER activity.
- Analyze trends influencing event frequency.
- Explore event relationships by program and event type.
- Support operational improvement initiatives.
IDT Summary
The IDT Summary page serves as the primary interdisciplinary team compliance dashboard. Unlike the remainder of the report, this page is based on Report Date rather than Event Date and focuses on compliance with approval requirements.
The page allows users to:
- Review GER approval compliance.
- Monitor reports approved within required timeframes.
- Identify unapproved or overdue reports.
- Support IDT review and follow-up activities.
Version Notes
The Version Notes page documents report calculations, business rules, data source changes, enhancement history, and report maintenance activities. It serves as the technical documentation for the report and provides reference information for users who need to understand how the report is built, maintained, and updated.
Tuesday, March 28, 2023
Get the latest file from Power BI
Daily or weekly reports constantly need data appended to a source folder in non-database situations. As the files pile up folder it can be a little difficult to differentiate between them in Power BI, when one really only needs the latest for a particular visualization or report page.
Another story on Medium, linked below, does a great job of detailing how to get only the latest file data. The solution points to creating a separate, identical query on the same pile of data and then, singling out the most recent report in the new query.
A few standard conventions are required to do this. Naming files to include a YYYYMMDD date prefix makes it a little easier to perform the sort needed but inserts an extra “hands on” step in the process. [Date Modified] or [Date Created] from the file attributes usually prove more useful.
While all of this is effective enough, it can make things a little clunky; especially true if seeking to have the queries always mirror one another. There are quite a few elegant solutions to do just that too, if one digs around enough.
There is a simpler solution. It still requires sorting the data in Power Query. It does not require another query.
In Power BI, a slicer leveraging whatever field used to do that sort pulls off the same stunt. Place a “Top N” filter on that slicer to show only the “Top 1” based on whatever seems most appropriate. In my use case, it is a date field and works perfect every time, with every “Scheduled Refresh,” and appears a little more flexible too.
There are a few limitations on editing the text that appears in the slicer. A few modifications may be needed to get the right look. However, it enables the report to host as many visualizations as needed, based on one data file, without an extra query and the need to maintain that query. I suspect it probably performs better too.
. . .
further reading
Friday, March 17, 2023
Payroll Hours Paid Report
The Payroll Hours Paid report provides visibility into payroll hours and labor costs across the organization. It is used to monitor paid hours, labor expenses, overtime utilization, PTO usage, salary hours, and staffing costs by location, employee group, and reporting period. The report supports workforce planning, financial management, budget monitoring, and labor-cost analysis.
All Hours
The All Hours page provides a comprehensive overview of paid hours and associated labor costs across the organization. This page serves as the primary executive dashboard for payroll utilization and labor cost monitoring.
The page allows users to:
- Review total labor hours, salary hours, overtime hours, differential hours, and PTO hours.
- Analyze labor and payroll costs by location.
- Monitor paid-hour trends over the previous 13 calendar months.
- Compare labor utilization across organizational units.
- Track workforce-related expenses over time.
Labor Hours
The Labor Hours page focuses specifically on worked labor hours and staffing utilization. This page serves as the operational labor analysis page for the report.
The page is intended to help users:
- Analyze labor-hour consumption.
- Monitor worked hours separate from salary and PTO hours.
- Evaluate workforce utilization patterns.
- Review labor-hour trends and staffing levels.
Decompose Labor Cost
The Decompose Labor Cost page is used to analyze and break down labor expenses into their contributing components. This page serves as the report's labor-cost analysis and troubleshooting page.
The page helps users:
- Identify factors driving labor costs.
- Compare labor costs across locations and departments.
- Understand contributors to payroll expense fluctuations.
- Investigate high-cost operational areas.
Decompose Labor Hours
The Decompose Labor Hours page provides deeper analysis into the factors contributing to labor-hour utilization. This page supports detailed workforce utilization analysis.
The page allows users to:
- Investigate labor-hour drivers.
- Analyze staffing utilization patterns.
- Compare labor-hour allocations across organizational units.
- Understand variations in worked hours.
OT Hours vs OT Cost
The OT Hours vs OT Cost page focuses specifically on overtime utilization and the associated payroll expense. This page serves as the report's primary overtime management and labor-cost monitoring page, helping leadership understand the relationship between overtime usage and payroll expense. It is intended to support workforce planning, scheduling decisions, and labor cost control efforts.
- Compare overtime hours against overtime labor costs.
- Identify locations generating the highest overtime expenses.
- Determine whether overtime cost increases are driven by more overtime hours, higher labor rates, or both.
- Monitor overtime trends over time.
- Evaluate the financial impact of overtime utilization across programs and departments.
Version Notes
The Version Notes page documents report calculations, business rules, data source changes, enhancement history, and report maintenance activities. It serves as the technical documentation for the report and provides reference information for users who need to understand how the report is built, maintained, and updated.
Popular Variations
-
The Training Variance report provides data and analysis for Missouri DD training tracking and training variance reporting. It compares Workf...
-
Slightly funny story. Someone contacted me last week and said they can't see anything in their report. We only imported the ...
-
The ROARS report provides data and analysis of ROARS recognition submissions. It helps leadership monitor employee recognition activity, ide...
-
The PAM Log report tracks activities performed by the Health Team that qualify as PAM services and related nursing-support functions. It hel...





