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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
bwiley
Frequent Visitor

Solved: Tickets carried over by quarter

I am struggling with a measure that will tell me opened tickets carried over by quarter. The measure I have will tell me how many tickets opened in that quarter were carried over but does not include tickets still open from the previous quarter.

 

For example if I have 20 tickets still open end of 2024-Q1 and I also have 5 tickets till open from Q4-2023 that were not resolved in Q1 I should get 25. I just get the 20. I know I am filtering something wrong but not sure how to fix it. 

------------------------------------

'Calendar' is my date table.

--------------------------------------

Measure:

 

Carryover Tickets =

VAR _min =
    MIN ( 'Calendar'[Date] )
VAR _max =
    MAX ( 'Calendar'[Date] )
VAR _result =
    CALCULATE (
        DISTINCTCOUNT ( sc_task[RITM / CNTR] ),
        FILTER (
            sc_task,
            sc_task[Open Date] <= _max
                && ( sc_task[Closed Date] >= _max
                || sc_task[Closed Date] = BLANK() )
        )
    )
RETURN
_result
 
-------------------------------------
Bar chart:
 
bwiley_0-1727987884570.png
-------------------------------------------------------------------------------------------------------
Snippet of how my table data looks:
 
RITM/CNTROpen DateClosed Date
111/1/2312/31/24
212/5/23 
31/5/242/6/24
42/1/243/1/24
52/15/24 
63/3/24 
Thank you!

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @bwiley ,

 

I made a sample for you.

vxiaocliumsft_0-1728027535086.png

Measure = 

VAR _min =
   MIN ( 'Calendar'[Date] )
VAR _max =
   MAX ( 'Calendar'[Date] )
VAR _result =
    CALCULATE (
        DISTINCTCOUNT ( 'sc_task'[RITM/CNTR] ),
        FILTER (
            ALL(sc_task),
            (sc_task[Open Date] <= _max &&
             sc_task[Closed Date] > _max) ||
             (sc_task[Open Date] <= _max &&
             sc_task[Closed Date]=BLANK())
        )
    )
RETURN
_result

vxiaocliumsft_1-1728027588278.png

 

Best Regards,

Wearsky

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @bwiley ,

 

I made a sample for you.

vxiaocliumsft_0-1728027535086.png

Measure = 

VAR _min =
   MIN ( 'Calendar'[Date] )
VAR _max =
   MAX ( 'Calendar'[Date] )
VAR _result =
    CALCULATE (
        DISTINCTCOUNT ( 'sc_task'[RITM/CNTR] ),
        FILTER (
            ALL(sc_task),
            (sc_task[Open Date] <= _max &&
             sc_task[Closed Date] > _max) ||
             (sc_task[Open Date] <= _max &&
             sc_task[Closed Date]=BLANK())
        )
    )
RETURN
_result

vxiaocliumsft_1-1728027588278.png

 

Best Regards,

Wearsky

I am going to mark the above as the solution since it gave me what I needed after I changed

ALL(sc_task),

to ALLEXCEPT(sc_task),

 

to account for the filters. 

 

Thank you very much!

 

This was my final solution:

 

VAR _min =
MIN ( 'Calendar'[Date] )
VAR _max =
MAX ( 'Calendar'[Date] )
VAR _result =
CALCULATE (
DISTINCTCOUNT (sc_task[RITM / CNTR] ),
FILTER (
ALLEXCEPT(sc_task,
sc_task[Type2],
sc_task[RITM Status 2],
sc_task[Assignment Group],
sc_task[RITM / CNTR],
ast_work[request_item.opened_at],
'Calendar'[Month Year Filter CLM FY23 Forward],
'Calendar'[Month Year Filter CLM Metrics]
),
(sc_task[Open Date] <= _max &&
sc_task[Closed Date] > _max) ||
(sc_task[Open Date] <= _max &&
sc_task[Closed Date]=BLANK())
)
)
RETURN
_result

Kedar_Pande
Super User
Super User

@bwiley ,

Updated version of your DAX measure:

Carryover Tickets = 
VAR _max = MAX('Calendar'[Date])
VAR _currentQuarterStart =
CALCULATE(
MIN('Calendar'[Date]),
FILTER('Calendar', 'Calendar'[Quarter] = QUARTER(_max) && 'Calendar'[Year] = YEAR(_max))
)
VAR _previousQuarterStart =
EDATE(_currentQuarterStart, -3)
RETURN
CALCULATE(
DISTINCTCOUNT(sc_task[RITM / CNTR]),
FILTER(
sc_task,
sc_task[Open Date] < _max &&
(sc_task[Closed Date] >= _max || sc_task[Closed Date] = BLANK() || sc_task[Closed Date] > _currentQuarterStart)
)
) +
CALCULATE(
DISTINCTCOUNT(sc_task[RITM / CNTR]),
FILTER(
sc_task,
sc_task[Open Date] < _previousQuarterStart &&
(sc_task[Closed Date] >= _max || sc_task[Closed Date] = BLANK())
)
)

If this helped, a Kudos 👍 or Solution mark would be great!

Cheers,

Kedar Pande

www.linkedin.com/in/kedar-pande

AllisonKennedy
Super User
Super User

@bwiley  the _Min and _Max variables will be impacted by your visual filters, so you may get the result you're looking for if you add an ALLSELECTED to them: 

Carryover Tickets =

VAR _min =
   CALCULATE( MIN ( 'Calendar'[Date] ), ALLSELECTED(Calendar) )
VAR _max =
  MAX ( 'Calendar'[Date] )
VAR _result =
    CALCULATE (
        DISTINCTCOUNT ( sc_task[RITM / CNTR] ),
        FILTER (
            sc_task,
            sc_task[Open Date] <= _max
                && ( sc_task[Closed Date] >= _max
                || sc_task[Closed Date] = BLANK() )
        )
    )
RETURN
_result

I think you still want your MAX to be filtered by the visual, so I didn't add the ALLSELECTED there, but if I misunderstood play around with that. 

 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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