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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
acbi
Frequent Visitor

how to relate a measure to the date?

I have created a measure that tell me how much how much did the company spend on the last purchase of a product compared to the previus one. I would like to show the evolution of this data over the months, this is what a get when I try to do it:

Capturar.PNG

 

 these are the formulas I used:

Saving =
[Valor médio do produto na penúltima compra]-[Valor médio do produto na última compra]
 
Valor médio do produto na penúltima compra =
CALCULATE(
[Valor médio produto],
FPEDIDODECOMPRA[Dt. Inclusao]=
MINX(
TOPN(2,FPEDIDODECOMPRA,FPEDIDODECOMPRA[Dt. Inclusao]),
FPEDIDODECOMPRA[Dt. Inclusao]))
 
Valor médio do produto na última compra =
CALCULATE(
[Valor médio produto],
FPEDIDODECOMPRA[Dt. Inclusao]=MAX(FPEDIDODECOMPRA[Dt. Inclusao]))
2 REPLIES 2
amitchandak
Super User
Super User

@acbi ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

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

Sure! 

We buy raw material that varies a lot in price, the ultimate goal is to show this variation over time graphically. This is an example of the table we currently use.

Capturar.PNG


the information given to me for this are the product, the purchase date and the average price per unit purchased.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.