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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Terrassa
Helper I
Helper I

How to use filters in a visual but ignore them in a measure used in the visual

Hello,

 

I have a ticketing system to manage IT incidents. Each ticket has a creation and close date (close date can be empty). I need a visual to show how many tickets were created and closed in each month and also how many remain open at the end of each month.

Terrassa_0-1704296896232.png

The visual should show only the last 12 months, but to calculate how many tickets are open it must include all the history because we can have tickets still open since more than 12 months ago.

 

I have this measure to calculare how many tickets are active at the end of each month:

Remaining open =
var created_jiras = calculate(count(Jira[Jira]), filter(allselected(Jira), Jira[Creation date] <= max('Calendar'[Date])))
var closed_jiras = calculate(count(Jira[Jira]), filter(allselected(Jira), Jira[Closed date] <= max('Calendar'[Date]) && Jira[Closed date] <> BLANK()))
var open_jiras = created_jiras - closed_jiras
return if(open_jiras<0,0,open_jiras)
 
But when I create the visual with a filter to show only the last 12 months, the measure "Remaining open" considers only the tickets created and closed during those 12 months, although I'm using the filter "allselected". This measure should consider all the tickets created and closed without applying any date filter.
 
Thank you very much in advance for your help
1 REPLY 1
Corey_M
Resolver II
Resolver II

you will likely want to use the filter keyword which would look something like this

Remaining Open =
VAR created_jiras = 
    CALCULATE(
        COUNT(Jira[Jira]),
        FILTER(
            ALL('Calendar'), 
            Jira[Creation date] <= MAX('Calendar'[Date])
        )
    )
VAR closed_jiras = 
    CALCULATE(
        COUNT(Jira[Jira]),
        FILTER(
            ALL('Calendar'),
            Jira[Closed date] <= MAX('Calendar'[Date]) && 
            Jira[Closed date] <> BLANK()
        )
    )
VAR open_jiras = created_jiras - closed_jiras
RETURN 
    IF(open_jiras < 0, 0, open_jiras)

 

it is possible that you have other filters that you might want to preserve which could require a slight editing of the code.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.