Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Drilling doesn't work

Original Post - https://community.powerbi.com/t5/Desktop/Monthly-Total-Open-Cases/mp/1284325#M561428

Can anyone advise how to get the following measurement to drill correctly?

In my previous post, a member successfully provided a qualifying metric (a month-to-month count of active users, with a start date and no end date, including those from previous months) See the context above.

The next step has me struggling again!

I understand that the drill-through feature is not possible with the current measure as we have a CALCULATE in the DAX and Power BI cannot use the complex measure to drill down. The first question I can take on from the measure created above will be "great, can I see who is active for each month, now I want to know, who are they?"

I'm trying to create a page where I can drill down to the list of PERSON_IDs that are in that month, from the measure created:

Active People (Active People)
WHERE maxdate?
MAX ('Calendar' [Date])
return
CALCULATE (
DISTINCTCOUNT (DM_PERIODS_OF_CARE [PERSON_ID]),
ALL ('Calendar' [Date]),
FILTER (
ALL (DM_PERIODS_OF_CARE),
DM_PERIODS_OF_CARE [START_DATE] <- maxdate
&& OR (
DM_PERIODS_OF_CARE [END_DATE]> maxdate,
ISBLANK (DM_PERIODS_OF_CARE [END_DATE])
)
)
)
I currently have a table on another page with Active Persons (which is the originally posted measure for the requirement) and PERSON_ID. It is not working however there are much more than 305 rows for the Aug 2020 exam as screenshot here:
problem.png
Any suggestions on this?
Thank you very much,
Dan.
  • Please try this measure added to your table visual on the drillthrough page.  I reproduced your scenario on my end and this appears to get your desired functionality.

     

    IsActive =
    VAR mindate =
        MIN ( 'Date'[Date] )
    VAR maxdate =
        MAX ( 'Date'[Date] )
    RETURN
        CALCULATE (
            COUNTROWS ( Employees ),
            ALL ( 'Date' ),
            OR ( Employees[EndDate] >= mindate, ISBLANK ( Employees[EndDate] ) ),
            Employees[StartDate] <= maxdate
        )

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

11 Replies

  • Anonymous , as of now you can only drill on dimension/column values

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak  I am trying to drill-through the bar chart visualisation, so that it shows the applicable PERSON_ID that is being counted for that month. For some reason the original bar chart was removed from my post, I have added it again.

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    You should be able to drill through on your month column.  Also, please try the modified expression.  It now only removes the filters from the date columns instead of from the whole table (including Person_ID).  It should return 1 for each active employee in the date range in scope.

     

    Active Persons =
    VAR maxdate =
    MAX ( 'Calendar'[Date] )
    RETURN
    CALCULATE (
    DISTINCTCOUNT ( DM_PERIODS_OF_CARE[PERSON_ID] ),
    ALL ( 'Calendar'[Date] ),
    FILTER (
    ALL ( DM_PERIODS_OF_CARE[START_DATE], DM_PERIODS_OF_CARE[END_DATE], ),
    DM_PERIODS_OF_CARE[START_DATE] <= maxdate
    && OR (
    DM_PERIODS_OF_CARE[END_DATE] > maxdate,
    ISBLANK ( DM_PERIODS_OF_CARE[END_DATE] )
    )
    )
    )
     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

     
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi mahoneypat,

       

      Unfortunately that does not work, it creates the same problem as in my original post. It filters the Active Persons for that month only, when what is needed is the count of active persons that have a start date and no end date that are active in that month and every month where they are active (as your original measure successfully does) e.g:

       

      person 1 has a start date in Jan 2020 and no end date, therefore needs to be counted in Jan, Feb, Mar, Apr, May, Jun, Jul, Aug. 

      person 2 has a start date in Mar 2020 and no end date, therefore needs to be counted in Mar, Apr, May, Jun, Jul, Aug.

      person 3 has a start date in Mar 2020 and an end date in Jun 2020, therefore needs to be counted in Mar, Apr, May, Jun.

       

      The next step is to be able to drill-through on that month (on the bar chart visualisation) and see who those active persons are for that month (in a table visualisation on another page)

       

      Please see my post as I have edited it for clarity. The bar chart shows the correct numbers, however when I drill-through to a page with a table with persons on, it does not work.

       

      Thanks again for your assistance Pat,

       

      Dan.

      • mahoneypat's avatar
        mahoneypat
        Icon for Microsoft Employee rankMicrosoft Employee

        Please try this measure added to your table visual on the drillthrough page.  I reproduced your scenario on my end and this appears to get your desired functionality.

         

        IsActive =
        VAR mindate =
            MIN ( 'Date'[Date] )
        VAR maxdate =
            MAX ( 'Date'[Date] )
        RETURN
            CALCULATE (
                COUNTROWS ( Employees ),
                ALL ( 'Date' ),
                OR ( Employees[EndDate] >= mindate, ISBLANK ( Employees[EndDate] ) ),
                Employees[StartDate] <= maxdate
            )

         

        If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

        Regards,

        Pat