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
Suhel_Ansari
Helper IV
Helper IV

How to find out new Country compared to Last Year

Hi All,

I want to find the New Country added to the system compared to previous years as seen in the following screen print, I need a measue to find which country was added this year compared to last year, so i need "Belgium" as my Output in the measure. Thanks

Ex :- For year 2022 it was "France" and for current year 2023 it is "Belgium" so I need "Belgium" as my output in the measure.

 

Suhel_Ansari_1-1679930506193.png

Reards

Suhel

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

Hi @Suhel_Ansari,

You can use the year as condition to filter table records to get two list of countries. (the first condition is filtering the records year less than current year; the second condition filter the records less than and equal to current year)

Then you can use except function to compare these lists to get the new added country list, check the current country if it included in the list and return flags.

EXCEPT function (DAX) - DAX | Microsoft Learn

The IN operator in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Suhel_Ansari,

You can use the year as condition to filter table records to get two list of countries. (the first condition is filtering the records year less than current year; the second condition filter the records less than and equal to current year)

Then you can use except function to compare these lists to get the new added country list, check the current country if it included in the list and return flags.

EXCEPT function (DAX) - DAX | Microsoft Learn

The IN operator in DAX - SQLBI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

@v-shex-msft 

Many Thank you for the Reply this the above solution I was about to achieve the output many.

Follwoing Measure give the Output. 

1 Final Measure =
VAR Lvalues =
CALCULATETABLE( VALUES(Table[Country]),FILTER( Table , Table[DeliveryDate].[Year] = YEAR( TODAY())-1))
VAR Cvalues =
CALCULATETABLE( VALUES(Table[Country]), FILTER( Table , Table[DeliveryDate].[Year] = YEAR( TODAY()) ))
VAR OTable = EXCEPT( Cvalues , Lvalues)
VAR CResult = COUNTROWS( OTable )
VAR Result = CONCATENATEX( OTable , Table[Country] , ", ")
RETURN
IF( ISBLANK(CResult) , "No New Country" , Result)

Suhel_Ansari
Helper IV
Helper IV

@amitchandak  , @lbendlin  , @Greg_Deckler , please assit

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.