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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.