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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mateus_luzzi
Helper I
Helper I

Measure that counts how many products had its price change between dates

Hello, friends!

 

It's the second time I'm posting this, I lost 10 min writing a good question text and for some reason this forum kicked me out and I lost all my text. 😥

 

OK, let's go: 

 

I'm comparing historical prices among several products, for pricing purposes.

 

I need a measure that counts how many products had it's price changed, between a date that an user will input (parameter) and the last price.

 

Let me give you an example:

 

The user chose a 30 day analysis and today is 12/22/2020.

 

ProductStorePrice SoldDatenot part of table, just comment
BananaJhonny's Groceries2011/22/202030 day analysis refer to this date
ApplePaul's Groceries1111/22/202030 day analysis refer to this date
AppleJhonny's Groceries911/22/202030 day analysis refer to this date
BananaJhonny's Groceries1811/24/2020 
BananaJhonny's Groceries1711/29/2020 
............ 
AppleCarl's Groceries1212/19/2020last price entry for 'apple'
BananaJen's Groceries1512/20/2020last price entry for 'banana'

 

So what is expected to happen:

 

  • Get the average price (because it's possible to have more than one record for a product in the same day) of X days earlier, in this case 30 days
  • Get the average of last price, something like that:

 

Last Avg Price = CALCULATE(AVERAGE(Sales[Price]),LASTDATE(Sales[Sale_Date]))

 

  • Count how many products price went up and how many went down
  • It might be a scalar, because I need to display this in a card

 

 

That's it!

 

Can somebody help me, please? Thank you!

 

2 REPLIES 2
amitchandak
Super User
Super User

@mateus_luzzi , Try a measure like


countx(filter(summarize(Table, Table[Product],"_1", distinctcount(Table[Price Sold])), [_1]>1),[Product])

 

This will any product that has changed the price

 

or try like

countx(filter(summarize(Table, Table[Product],"_1", calculate(distinctcount(Table[Price Sold]), allexpcept(Table, Table[Product]))), [_1]>1),[Product])

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

Hello, friend @amitchandak 

 

I really appreciate your time. Unfortunately it didn't work. Do you have any other suggestions?

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.