Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
72 | |
67 | |
42 | |
28 | |
21 |