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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.