Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Aknas
Frequent Visitor

Visually compare scheduled hours and completed hours

Hi All,

I am trying to visually compare scheduled hours with completed hours to identify incomplete shifts. Despite my attempts, I have been unable to achieve the desired result. I have attached a sample workbook that includes both tables and the intended outcome for reference.

Here is a brief overview of what I have been attempting:

  1. I have created a table matrix where the "Scheduled Start Shift Date and Time" column is compared to the "Completed Start Shift Date and Time" column.
  2. The objective is to fill the cell with green if there is a match between the two columns, indicating a completed shift. Conversely, the cell should be filled with red if there is no match, implying an incomplete shift.

However, my current implementation has not yielded the expected results. Therefore, I am seeking your expertise to help me resolve this issue. I would greatly appreciate any guidance or insights you can provide.

Please find the attached sample workbook, which includes the necessary tables and the desired outcome, for your reference. Your assistance in this matter would be invaluable to me.

Thank you for your time and consideration

 

Dii

  Scheduled table 
CategoryWorker IDstart_date_timeend_date_time
A12022-10-24 10:00:002022-10-25 18:00:00
A12022-10-26 10:00:002022-10-26 18:00:00
B22022-10-17 14:00:002022-10-17 22:00:00
B22022-10-05 17:00:002022-10-06 00:00:00
C32022-10-06 17:00:002022-10-06 00:00:00

 

 Completed table   
Worker IDstart_date_timeend_date_timedurationCategory
12022-10-24 10:00:002022-10-25 18:00:008A
22022-10-17 14:00:002022-10-17 22:00:000B
22022-10-05 17:00:002022-10-06 00:00:007B

 

sample incomple shift.jpg

2 ACCEPTED SOLUTIONS
v-yanjiang-msft
Community Support
Community Support

Hi @Aknas ,

According to your description, here's my solution.

Column in the matrix is of text format in my sample.

vyanjiangmsft_0-1684822801212.png

Create two measures.

Value =
IF (
    MAX ( 'Table'[Column1] )
        IN SELECTCOLUMNS (
            'Scheduled',
            "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
        )
            && MAX ( 'Table'[Column1] )
                IN SELECTCOLUMNS (
                    'Completed',
                    "DATE", FORMAT ( 'Completed'[start_date_time], "DD-MMM" )
                ),
    " ",
    IF (
        MAX ( 'Table'[Column1] )
            IN SELECTCOLUMNS (
                'Scheduled',
                "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
            ),
        " "
    )
)
Color =
IF (
    MAX ( 'Table'[Column1] )
        IN SELECTCOLUMNS (
            'Scheduled',
            "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
        )
            && MAX ( 'Table'[Column1] )
                IN SELECTCOLUMNS (
                    'Completed',
                    "DATE", FORMAT ( 'Completed'[start_date_time], "DD-MMM" )
                ),
    "GREEN",
    IF (
        MAX ( 'Table'[Column1] )
            IN SELECTCOLUMNS (
                'Scheduled',
                "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
            ),
        "ORANGE"
    )
)

Put the measure Value in matrix values and in the matrix visualizations formatting>Cell elements, turn on the Backgroud color option and click "fx".

vyanjiangmsft_1-1684823212446.png

Select the measure color in the below dialog.

vyanjiangmsft_2-1684823304443.png

Get the correct result:

vyanjiangmsft_3-1684823356601.png

I attach my sample below for your reference.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best regards,

Community Support Team_yanjiang

 

View solution in original post

Thanks Yan.

The solution works Perfect!!

 

Thanks again

 

View solution in original post

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @Aknas ,

According to your description, here's my solution.

Column in the matrix is of text format in my sample.

vyanjiangmsft_0-1684822801212.png

Create two measures.

Value =
IF (
    MAX ( 'Table'[Column1] )
        IN SELECTCOLUMNS (
            'Scheduled',
            "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
        )
            && MAX ( 'Table'[Column1] )
                IN SELECTCOLUMNS (
                    'Completed',
                    "DATE", FORMAT ( 'Completed'[start_date_time], "DD-MMM" )
                ),
    " ",
    IF (
        MAX ( 'Table'[Column1] )
            IN SELECTCOLUMNS (
                'Scheduled',
                "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
            ),
        " "
    )
)
Color =
IF (
    MAX ( 'Table'[Column1] )
        IN SELECTCOLUMNS (
            'Scheduled',
            "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
        )
            && MAX ( 'Table'[Column1] )
                IN SELECTCOLUMNS (
                    'Completed',
                    "DATE", FORMAT ( 'Completed'[start_date_time], "DD-MMM" )
                ),
    "GREEN",
    IF (
        MAX ( 'Table'[Column1] )
            IN SELECTCOLUMNS (
                'Scheduled',
                "date", FORMAT ( 'Scheduled'[start_date_time], "DD-MMM" )
            ),
        "ORANGE"
    )
)

Put the measure Value in matrix values and in the matrix visualizations formatting>Cell elements, turn on the Backgroud color option and click "fx".

vyanjiangmsft_1-1684823212446.png

Select the measure color in the below dialog.

vyanjiangmsft_2-1684823304443.png

Get the correct result:

vyanjiangmsft_3-1684823356601.png

I attach my sample below for your reference.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Best regards,

Community Support Team_yanjiang

 

Thanks Yan.

The solution works Perfect!!

 

Thanks again

 

Aknas
Frequent Visitor

Corrected the screenshot ( desired result)sample incomple shift.jpg

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.