Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
M_SBS_6
Helper V
Helper V

Flag to show new value

Hi, 

I have 2 columns of data, appname and appdate. I have 4 years worth of data.

 

What I'd like to do is add a column (new app this year) to identify new appname I.e if we take 2024, those that have come in this year onky but we don't have a record of them in the previous 3 years.

 

Any idea if this is possible please and to also make it work once we hit 2025 on so on please? 

1 ACCEPTED SOLUTION
v-cgao-msft
Community Support
Community Support

Hi @M_SBS_6 ,

Please try:

Column 1 = 
VAR _max_year = YEAR(MAX('Table'[appdate]))
VAR _cur_appname = 'Table'[appname]
VAR _count = CALCULATE(COUNTROWS('Table'),YEAR('Table'[appdate])<_max_year && 'Table'[appname]=_cur_appname)
VAR _result = IF(ISBLANK(_count),"Yes")
RETURN
_result

or (last 3 years):

Column 2 = 
VAR _max_year = YEAR(MAX('Table'[appdate]))
VAR _min_year = _max_year - 3
VAR _cur_appname = 'Table'[appname]
VAR _count = CALCULATE(COUNTROWS('Table'),'Table'[appname]=_cur_appname && YEAR('Table'[appdate])>=_min_year && YEAR('Table'[appdate])<_max_year)
VAR _result = IF(YEAR('Table'[appdate])=_max_year&&ISBLANK(_count),"Yes")
RETURN
_result

vcgaomsft_0-1705308973078.png

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

View solution in original post

2 REPLIES 2
v-cgao-msft
Community Support
Community Support

Hi @M_SBS_6 ,

Please try:

Column 1 = 
VAR _max_year = YEAR(MAX('Table'[appdate]))
VAR _cur_appname = 'Table'[appname]
VAR _count = CALCULATE(COUNTROWS('Table'),YEAR('Table'[appdate])<_max_year && 'Table'[appname]=_cur_appname)
VAR _result = IF(ISBLANK(_count),"Yes")
RETURN
_result

or (last 3 years):

Column 2 = 
VAR _max_year = YEAR(MAX('Table'[appdate]))
VAR _min_year = _max_year - 3
VAR _cur_appname = 'Table'[appname]
VAR _count = CALCULATE(COUNTROWS('Table'),'Table'[appname]=_cur_appname && YEAR('Table'[appdate])>=_min_year && YEAR('Table'[appdate])<_max_year)
VAR _result = IF(YEAR('Table'[appdate])=_max_year&&ISBLANK(_count),"Yes")
RETURN
_result

vcgaomsft_0-1705308973078.png

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

Ritaf1983
Super User
Super User

Hi @M_SBS_6 
It sounds like a new / repeat customers scenario.

Take a look at the attached article.
https://blog.finance-bi.com/power-bi-new-and-repeat-customers/

If it doesn't help 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
Please show the expected outcome based on the sample data you provided.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors