Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello - I am trying to solve how to find the number of unique customer different regions acquire of a year period. The solution will help my sales leadership see how many new customers are buying from us this year vs last year. We do have repeat customers and when I use "distinctcount" and drop in the year repeat customers get counted in each year.
In the image below, the two rows in yellow indicate where the same customer purchased in 2023 and 2024, but should of only been counted in 2023.
Can anyone help?
Solved! Go to Solution.
Hi @RAQuest ,
Try replacing SELECTEDVALUE with MIN.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Hi @RAQuest ,
Please try this measure:
Measure =
VAR __cur_year = SELECTEDVALUE('Date'[Year])
VAR __pre_year_count = CALCULATE(DISTINCTCOUNT('Table'[Customer Name]),'Date'[Year]=__cur_year-1)
VAR __cur_year_count = DISTINCTCOUNT('Table'[Customer Name])
VAR __result = IF(ISBLANK(__cur_year_count) || __pre_year_count>0, BLANK(), 1)
RETURN
__result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Gao,
Thank you for the response - I am trying to create this measure in Power Pivot and not PBI. I noticed in your solution "SelectedValue" is not an option in Power Pivot. How would you suggest around this issue?
Thanks in advance for your time,
RA
Hi @RAQuest ,
Try replacing SELECTEDVALUE with MIN.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum -- China Power BI User Group
Gao - thank you - this worked and I appreciate the help. If you could help me with one final tweek, I would appreciate it. I am showing the number of accounts (thank you), but I do not show a total - see image and measure below.
YoY Customer Count:=VAR CurrentYear = YEAR(TODAY())
VAR PreviousYearCount = CALCULATE(DISTINCTCOUNT('Table2'[BillToName]),'Calendar'[Year]=CurrentYear-1)
VAR CurrentYearCount = DISTINCTCOUNT('Table2'[BillToName])
VAR Result = IF(ISBLANK(CurrentYearCount) || PreviousYearCount>0, BLANK(), 1)
RETURN
Result
@RAQuest Is that what the source data looks like or ? Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
27 | |
12 | |
11 | |
11 | |
9 |
User | Count |
---|---|
53 | |
30 | |
15 | |
14 | |
13 |