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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.