Calculate Outstanding RTSK
Measure 1: Count of RTSK opened in a month but not closed in the same month
First, we'll create a calculated column to flag if an RTSK was not closed in the same month it was opened:
Create a Calculated Column in the
RTSK_openedtable:daxRTSK_NotClosedSameMonth = VAR ClosedDate = CALCULATE( MAX('RTSK_closed'[RTSK Closed Date]), 'RTSK_closed'[RTSK Number] = 'RTSK_opened'[RTSK Number] ) RETURN IF( YEAR('RTSK_opened'[RTSK Opened Date]) <> YEAR(ClosedDate) || MONTH('RTSK_opened'[RTSK Opened Date]) <> MONTH(ClosedDate), TRUE(), FALSE() )Create a New Measure for RTSKs opened in a month but not closed in the same month:
daxRTSKOpenedNotClosedSameMonth = CALCULATE( DISTINCTCOUNT('RTSK_opened'[RTSK Number]), 'RTSK_opened'[RTSK_NotClosedSameMonth] = TRUE() )
Measure 2: Count of RTSK closed in a month but not opened in the same month
Similarly, we'll create a calculated column to flag if an RTSK was not opened in the same month it was closed:
Create a Calculated Column in the
RTSK_closedtable:daxRTSK_NotOpenedSameMonth = VAR OpenedDate = CALCULATE( MAX('RTSK_opened'[RTSK Opened Date]), 'RTSK_opened'[RTSK Number] = 'RTSK_closed'[RTSK Number] ) RETURN IF( YEAR('RTSK_closed'[RTSK Closed Date]) <> YEAR(OpenedDate) || MONTH('RTSK_closed'[RTSK Closed Date]) <> MONTH(OpenedDate), TRUE(), FALSE() )Create a New Measure for RTSKs closed in a month but not opened in the same month:
daxRTSKClosedNotOpenedSameMonth = CALCULATE( DISTINCTCOUNT('RTSK_closed'[RTSK Number]), 'RTSK_closed'[RTSK_NotOpenedSameMonth] = TRUE() )
Plotting the Bar Graphs
Go to the Report view in Power BI Desktop.
Select the Bar Chart visual from the Visualizations pane.
Plot 1: RTSK Opened in a Month but Not Closed in the Same Month
Drag and Drop the
YearMonthcolumn from theDatetable to the Axis field.Drag and Drop the
RTSKOpenedNotClosedSameMonthmeasure to the Values field.Customize the bar chart as needed (e.g., add titles, adjust colors).
Plot 2: RTSK Closed in a Month but Not Opened in the Same Month
Select another Bar Chart visual from the Visualizations pane.
Drag and Drop the
YearMonthcolumn from theDatetable to the Axis field.Drag and Drop the
RTSKClosedNotOpenedSameMonthmeasure to the Values field.Customize the bar chart as needed.
No comments