Search code examples
powerbidaxpowerbi-desktoppowerbi-custom-visuals

Chart requests vs assignments per week


I am struggling with something that I think must be simple, but I can't seem to figure it out. I want to use Power BI to chart requests vs assignments per week. I have the dates requests were logged and the date they were assigned.

I want a chart to show per calendar week, how many requests came in that week and how many were assigned that week.

Some sample data:

Logged:

03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23
03-Jul-23

Assigned:

11-Jul-23
04-Jul-23
11-Jul-23
11-Jul-23
11-Jul-23
11-Jul-23
04-Jul-23
04-Jul-23
11-Jul-23
04-Jul-23
11-Jul-23
11-Jul-23
11-Jul-23
04-Jul-23

I tried charting them in a clustered column but they group by either the log date or assign date. I think I need an absolute date reference (from a date table maybe) and I tried that also but can't make it work.


Solution

  • I solved this by creating two relationships between the Calendar dimension and the event fact tables. One relationship is between Calendar[Date] and Event[LogDate] and the other is between Calendar[Date] and Event[AssignDate]. Then I created two simple measures:

    Assigned Count = CALCULATE(
                        COUNTROWS('Events'),
           USERELATIONSHIP(DimDate[Date], Events[Assigned])
    )
    

    and

    Logged Count = CALCULATE(
                        COUNTROWS('Events'),
    USERELATIONSHIP(DimDate[Date],Events[Logged])
    )
    

    then all the "logged" ones show up on the logged date, and the "Assigned" ones show up on the assigned date. After that everything is simple. Then you can just reuse those measures if you need to when creating other measures (like if you need to date-shift one).