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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
frstrich
New Member

How to remove certain filters and slices but keep others

Hi,

 

I have only one Table in Power BI Desktop, imported from an excel sheet, containing Data of support tickets called Tickets.

It's roughly shaped like this:

Ticket-IDCreatedClosedOrganisation
TIC00001 11.01.2022 11:18:01 11.01.2022 12:30:41 GF
TIC00002 11.01.2022 11:34:30  KA
TIC..... 18.07.2023 12:00:12 19.07.2024 08:14:30 FR
TIC29784 27.05.2024 06:50:18  MI

 

As you can see, if a ticket has not been closed yet, there is no date in the corresponding column.

 

I want to have a bar-chart, where the amount of tickets still open at the end of each month is displayed - filterable by Organisation, so I created a bar chart, plotting the Year and Month of Created as the x-axis, as well as the following measure:

 

 

 

 

OpenTickets = 
VAR SelectedDate = EOMONTH(MAX('Tickets'[Created].[Date]),0)
RETURN COUNTROWS(
    CALCULATETABLE(
        ALLSELECTED(Tickets),
        REMOVEFILTERS(Tickets[Created]),
        INT('Tickets'[Created]) <= INT(SelectedDate) && (INT('Tickets'[Closed]) >= INT(SelectedDate) || ISBLANK('Tickets'[Closed]))
    )
)

 

 

 

 

 

I use INT(date) because sometimes Power BI gets confused by the timestamp inside the Created or Closed datetime

 

Sadly this does not work as expected: If I select a year outside of the plot (either as a slicer or as a selection in another chart) the amount of open tickets gets reduced by the amount of tickets created in the years now out of scope. This is of course fixed by using ALL instead of ALLSELECTED, but then the chart does not change, when selecting different organisations (also either as a slicer or selection in another chart).

 

I also tried using COUNTROW(FILTER(ALLSELECTED(...))) but this does not work either.

 

Is there any way to achieve what I want?

 

Thanks

1 ACCEPTED SOLUTION

Hi @frstrich 

Like this?

SamWiseOwl_0-1722861216856.png

 

Your code was correct, all you needed was to specify to remove the Year filter:

OpenTickets =
VAR SelectedDate =CALCULATE( EOMONTH(MAX('Tickets'[Created].[Date]),0), all('Tickets'[Created]))
RETURN COUNTROWS(
    CALCULATETABLE(
        ALLSELECTED(Tickets),
        REMOVEFILTERS(Tickets[Created].[Year]),
        INT('Tickets'[Created]) <= INT(SelectedDate) && (INT('Tickets'[Closed]) >= INT(SelectedDate) || ISBLANK('Tickets'[Closed]))
    )
)

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

6 REPLIES 6
mickey64
Super User
Super User

Step 0: I use your data below.

mickey64_0-1722859532083.png

 

Step 1: I add a 'Date Created' column and a 'Date Closed' column on Power Query Editor.

mickey64_1-1722859593573.png

 

Step 2: I unpivot these column.

- After Unpivot -

mickey64_2-1722859731713.png

 

Step 3: I add a 'Flag' column and change the type of the column.

mickey64_3-1722859779873.png

 

Step 4: I make a calendar table and add a relationship.

Calendar = CALENDAR(FIRSTDATE('Tickets'[Value]),LASTDATE('Tickets'[Value]))

 

mickey64_5-1722859985054.png

 

Step 5: I make a measure and a graph.

M_Flag = CALCULATE(SUM('Tickets'[Flag]),FILTER(ALLSELECTED('Calendar'[Date]),'Calendar'[Date]<=MAX('Calendar'[Date])))

 

mickey64_4-1722859848161.png

 

Thanks, I would have to restructure my layouts for this, but the idea is really interesting

SamWiseOwl
Super User
Super User

Hi @frstrich 

Is this a rough idea of what the issue looks like:

SamWiseOwl_0-1722858939578.png

And when you tick a year:

SamWiseOwl_1-1722858961801.png

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Precisely. If I select the year the amount of open tickets gets reduced, but the amount should not depend on the year selected, but should depend on the selected organisations

Hi @frstrich 

Like this?

SamWiseOwl_0-1722861216856.png

 

Your code was correct, all you needed was to specify to remove the Year filter:

OpenTickets =
VAR SelectedDate =CALCULATE( EOMONTH(MAX('Tickets'[Created].[Date]),0), all('Tickets'[Created]))
RETURN COUNTROWS(
    CALCULATETABLE(
        ALLSELECTED(Tickets),
        REMOVEFILTERS(Tickets[Created].[Year]),
        INT('Tickets'[Created]) <= INT(SelectedDate) && (INT('Tickets'[Closed]) >= INT(SelectedDate) || ISBLANK('Tickets'[Closed]))
    )
)

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Oh wow, thank you very much. I wasn't aware that you had to specify the exact filter and the parent element isn't enough.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.