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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.