Forum Discussion

RichardLBHF1's avatar
RichardLBHF1
New Member
1 year ago
Solved

Creating Team reports that are date sensitive

I want ot be able to run reports for teams that only pick up stats for when the people are in that team. I have a table for each team. In the table is Team Number, Name, start date and end date. The ...
  • DataNinja777's avatar
    1 year ago

    Hi RichardLBHF1 ,

     

    I generated dummy data to simulate your case. To achieve your requirement, you'll be using a technique similar to the headcount analysis discussed in the link below. 

    https://community.fabric.microsoft.com/t5/Community-Blog/Dynamic-Headcount-Analysis-using-Dax/ba-p/4164529

    In a nutshell, you only need two tables to achieve your desired output:

    1. A team table with Team Number, Name, start date, and end date.
    2. A disconnected calendar table.

    Your data model would look like the diagram below, where the two tables remain disconnected.

    Next, you would write a measure like the one below:

    Team duration = 
    SUMX (
        Teams,
        IF (
            Teams[Start Date] <= max('Calendar'[Date])
                && Teams[End Date] >= max('Calendar'[Date]),
            1,
            BLANK ()
        )
    )

    In order to create a Gantt-chart-esque visual using the standard matrix visual, I added background color to the measure by writing a measure like the one below:

    ColorMeasure = 
    IF(
        ISBLANK([Team duration]),
        BLANK(),
        IF([Team duration] > 0, "#FFC0CB", BLANK())  // Pink for positive numbers, no color for blank cells
    )
    

    The resulting output looks like the one below, where you can filter by fields from both the calendar table and the team table to see the status of the team on any selected dates.

    While you can explore a more refined look using a custom Gantt chart visual, the matrix table can also achieve a basic Gantt-chart-like appearance, displaying the project duration and the team members.

    I have attached an example pbix file for your reference.

     

    Best regards,