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

Assign price/cost to the first occuring each month

Hi,

 

I have a dataset of Date - Month - Product - Category where there are 3 categories and around 40 products.

 

I want to assign a cost only for the first occurence of each product in each month based on the category they belong to. Note that "Product" is not unique. Any advice for how to implement that?

 

Thanks for help!

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

Hi @Mal1

Although, i don't know how to assign a cost for the first occurence of product, i can figure out which ones are the first occurence of product.

Look at my test, 

First sort the table by "date" column (Modeling->Sort by column),

Second, in query editor,create an index column from 1, 

Third, create calculated columns below

minvalue = CALCULATE(MIN([Index]),ALLEXCEPT(Sheet1,Sheet1[Category],Sheet1[Month],Sheet1[Product]))
firstoccurence = IF([minvalue]=[Index],[Product])

2.png

Best Regards

Maggie

 

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @Mal1

Although, i don't know how to assign a cost for the first occurence of product, i can figure out which ones are the first occurence of product.

Look at my test, 

First sort the table by "date" column (Modeling->Sort by column),

Second, in query editor,create an index column from 1, 

Third, create calculated columns below

minvalue = CALCULATE(MIN([Index]),ALLEXCEPT(Sheet1,Sheet1[Category],Sheet1[Month],Sheet1[Product]))
firstoccurence = IF([minvalue]=[Index],[Product])

2.png

Best Regards

Maggie

 

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.