Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I would like to calculate the first occurence of customer based on period selected.
| Date | CustomerID | EventID |
| 1/1/2023 | 1 | 1 |
| 1/1/2023 | 2 | 2 |
| 1/2/2023 | 3 | 3 |
| 1/2/2023 | 1 | 4 |
| 1/2/2023 | 2 | 5 |
| 1/3/2023 | 1 | 6 |
| 1/3/2023 | 1 | 7 |
| 1/3/2023 | 3 |
8 |
I want the result to look like this for period from 1/1/2023 - 1/2/2023
| 1/1/2023 | 1/2/2023 | Total | |
| 1 | 1 | 0 | 1 |
| 2 | 1 | 0 | 1 |
| 3 | 1 | 1 | 1 |
| Total | 2 | 1 | 3 |
I want the result to look like this for period from 1/2/2023 - 1/3/2023
| 1/2/2023 | 1/3/2023 | Total | |
| 1 | 1 | 0 | 1 |
| 2 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 |
| Total | 3 | 0 | 3 |
Solved! Go to Solution.
Just adjust the measure a little bit.
Demo - Calculate the first occurence based on selected period.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Hi @mimingiang ,
You can try below measure.
first occurence of custome =
VAR SelectedPeriod = ALLSELECTED('Table'[Date])
RETURN
SUMX(
SUMMARIZE('Table','Table'[CustomerID],'Table'[Date]),
IF(CALCULATE(MIN('Table'[Date]),SelectedPeriod)='Table'[Date],1)
)
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
@xifeng_L Thank you so much for your reply. However, I need to make it work on Month level and it won't work for Month level if I have multiple dates in one month. Do you know how to make it work on month level?
Date CustomerID
01/01/2023 A
01/01/2023 A
02/01/2023 A
02/01/2023 C
01/02/2023 A
02/02/2023 B
02/02/2023 C
02/02/2023 A
01/03/2023 A
01/03/2023 B
01/03/2023 C
I want the result to look like this for period from 1/1/2023 - 1/2/2023
| 01/2023 | 02/2023 | Total | |
| A | 1 | 1 | |
| B | 1 | 1 | |
| C | 1 | 1 | |
| Total | 2 | 1 | 3 |
Just adjust the measure a little bit.
Demo - Calculate the first occurence based on selected period.pbix
Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !
Thank you~
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |