- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Count first Occurrence of Ticket by Month
Hi,
Wondering if you can help.
We have a model that is used by multiple users so would like to create this as a measure (no calc columns or power Query changes).
Scenario: We have tickets that can be created against our products.
The user would like a YTD chart by month for the current year.
The user would like to count the first occurrence of a specific ticket type (type ID 1) being raised against an product.
Multiple occurrences of the same ticket type can be raised against one product.
If the first occurence was outside of current YTD, then no tickets should be counted.
Current YTD assumed to be 2024 Jan - Aug.
I thought I could get there using ADDCOLUMNS and adding a ranking column.
I added the rank column but unsure how to use that added column to then restrict the results.
Image showing data structure below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Louis020790 , ahadkarimi, thank you for your prompt reply!
Please create two measures as shown below:
FirstTicketMonth = CALCULATE(MIN('Table'[Year Month]),FILTER(ALL('Table'),'Table'[Product ID]=MAX('Table'[Product ID])&&'Table'[Ticket Type ID]=1))
IsCount = IF(MONTH([FirstTicketMonth])<=8 && YEAR([FirstTicketMonth])=2024&& MAX('Table'[Ticket Type ID])=1&& [FirstTicketMonth]=MAX('Table'[Year Month]),"Yes","No")
Result for your reference:
Best regards,
Joyce
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Louis020790, try this measure below, and if you encounter any issues, let me know.
FirstOccurrenceCountYTD =
VAR CurrentYear = 2024
VAR YTDEndMonth = 8
VAR FilteredTable =
FILTER(
'TableName',
'TableName'[Ticket Type ID] = 1 &&
YEAR('TableName'[Year Month]) = CurrentYear &&
MONTH('TableName'[Year Month]) <= YTDEndMonth
)
VAR MinYearMonthTable =
ADDCOLUMNS(
SUMMARIZE(
FilteredTable,
'TableName'[Product ID]
),
"MinYearMonth", MINX(
CALCULATETABLE(
FilteredTable,
ALLEXCEPT('TableName', 'TableName'[Product ID])
),
'TableName'[Year Month]
)
)
RETURN
COUNTROWS(
FILTER(
MinYearMonthTable,
'TableName'[MinYearMonth] <= (CurrentYear * 100 + YTDEndMonth)
)
)
Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for the proposal, but this doesn't work.
No results returned in my test dataset.
I alos removed Ticket Type to simplify further and counted all records of table

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
07-13-2024 07:55 AM | |||
09-01-2024 08:06 AM | |||
09-09-2024 05:05 AM | |||
11-20-2024 11:51 AM | |||
03-25-2024 01:38 PM |
User | Count |
---|---|
25 | |
15 | |
12 | |
8 | |
8 |
User | Count |
---|---|
19 | |
15 | |
14 | |
13 | |
13 |