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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Search same value in same table between two dates

I have one table which has my products. 

 

For each product finds if it was listed in a specific month in the past (the minimun of the date range, here lets say [oct, nov,dec,jan] with min = oct and current=jan) and score each product  as following:

 

1- Product present in both months 100 

2- If Newly listed then score is 50 

3- If was present in the reference period and not listed now then -50

 

I have only table  as follows

DateProductidprice
1-Jan110
1-Dec120
1-Nov130
1-Oct140
1-Jan210
1-Dec212
1-Nov213
1-Jan312
1-Dec314
1-Nov315
1-Oct329
1-Dec414
1-Nov415
1-Oct429

 

Desired result shoul be 

Product score
1100
250
3100
4-50

 

I will appreciate your help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak Thank you very much.

It works as expected. Really thank you! this saves long hours of work

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

I converted month into date to work with

Measure = 
var _min = minx(all(Sheet1),Sheet1[Date])
var _max = maxx(all(Sheet1),Sheet1[Date])
var _before = CALCULATE(max(Sheet1[price]),filter((Sheet1),Sheet1[Date]=_min))
var _after = CALCULATE(max(Sheet1[price]),filter((Sheet1),Sheet1[Date]=_max))
Return
//maxx(VALUES(Sheet1[Productid]),_before & " "& _after)
if(ISBLANK(_after),-50,if(not(ISBLANK(_before)),100,50))

 

You can use first or last date of month

link: https://www.dropbox.com/s/kvazja8tnzqzq6a/samevalue.pbix?dl=0

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak Thank you very much.

It works as expected. Really thank you! this saves long hours of work

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors