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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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