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
saron
Frequent Visitor

New Items Based on the sales of last Six Months

saron_0-1686302753116.png

 this is my sample table which i used in power bi. the yellow highlighted column is the one i want to create.
now i am trying to create new calculated column in power bi if the item_code is newSKU or not based on the MonthKey.
For example, in CurrentMonth, item_code '33' is in Jun-23 MonthKey and not present in the last six months so it can say Yes as newSKU 
but for item_code '22' it present in both Jun-22 and May-22 that mean it present in both current month and also in the last six months so it is No in newSKU.

any suggestion on how to get that in DAX functions on that? Thanks in advance.

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

newSKU = if(Data[isCurrentMonth]="Yes",if(CALCULATE(COUNTA(Data[Item_Code]),FILTER(Data,Data[Item_Code]=EARLIER(Data[Item_Code])&&Data[MonthKey]>=EDATE(EARLIER(Data[MonthKey]),-6)))>1,"No","Yes"))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

newSKU = if(Data[isCurrentMonth]="Yes",if(CALCULATE(COUNTA(Data[Item_Code]),FILTER(Data,Data[Item_Code]=EARLIER(Data[Item_Code])&&Data[MonthKey]>=EDATE(EARLIER(Data[MonthKey]),-6)))>1,"No","Yes"))

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

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

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

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.