Forum Discussion

Charlespbi's avatar
Charlespbi
Regular Visitor
4 months ago
Solved

How to handle two date conditions on the same chart while keeping visual interaction in Pow

Hello,

 

I have been trying for several days now to solve an issue in my Power BI report.

 

Context:
I am analyzing ticket creation, resolution date, and compliance for a client.

 

How:
I determine whether tickets fall within the scope of the analysis by applying several filters:

  • ticket type
  • resolution date
  • a date range
  • status

Why:
Once the tickets meet these criteria, my measure returns "OK" if they are compliant, or "KO" if they are not.

 

Requirements:
First, I need to check that tickets are in "Authorized" status and that their [duedate] is earlier than the date selected in the filter.

Second, I need to check that tickets are in status ("Qualified" OR "Closed") and that [duedate] falls within a date range selected in the filter.

Additional constraints:

  • Both KO and OK tickets must be displayed on the same chart.
  • There must be only one single [duedate] date filter on the report page.
  • The chart must remain interactive with the table showing the ticket details within the analysis scope. In other words, when I click on the "KO" slice in the chart, only KO tickets should appear in the table. Same for OK tickets.

 

Here is the formula with the date filters included, just to illustrate the logic:

C1 = 
IF(
    AND(
        OR(
            NOT(AND(
                'TABLE'[statusName] = "Authorized",
                'TABLE'[duedate]<=DATE(2025,12,15)
            )),
            'TABLE'[statusName] IN {"Technically qualified", "Operationally qualified", "Closed"} &&
            NOT(ISBLANK('TABLE'[TQ_StatusDate])) &&
            'TABLE'[duedate] >= DATE(2025,09,01) &&
            'TABLE'[duedate] <= DATE(2025,12,15)
            ),
            'TABLE'[TQ_StatusDate]<='TABLE'[duedate]
    ),
    "OK",
    "KO"
)

 

Problem:
If I filter on the interval from 2025-09-01 to 2025-12-15, the first part of my formula is no longer exhaustive, because for that part I need to include everything before 2025-12-15, not just what falls inside the selected interval.

I managed to work around this by using the ALL() function (to remove the date constraint) in order to count tickets matching the criteria and display them in a single chart, but this only gives me aggregated counts and removes the interaction with the detail table.

 

Thank you in advance for your help.

 

Charles

7 Replies

    • Charlespbi's avatar
      Charlespbi
      Regular Visitor

      Hello techies, that solves the problem ; thank you very much.
      Unfortunately, another issue has come up.

      Let’s say I want to filter tickets by resolver group. Since there is no relationship between the ‘ComplianceCategories’ table and the ‘Tickets’ table, the filters don’t apply to the chart.

      Should I follow the same logic as for the ‘SlicerDate’ table and create a ‘Contract’ table?

      • techies's avatar
        techies
        Icon for Super User rankSuper User

        yes, and also Replace ALL with ALLSELECTED in Count OK and Count KO so any slicer on the Tickets table works

         

         

  • Hey,

    i think you need to use a separate date table. Could you attach a pbix file? It will be easier.