- 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
Find the number of unique customer over a two year period
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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.
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
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!
Microsoft Fabric Community Conference 2025
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
Subject | Author | Posted | |
---|---|---|---|
08-05-2024 02:20 AM | |||
08-13-2024 09:37 AM | |||
07-31-2024 01:50 PM | |||
08-08-2024 04:12 PM | |||
03-16-2024 05:53 PM |