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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Query prices for certain ID at maximum date

Hi community!

I am trying to build a measure to set a query for the prices [Cotacao] for the ID product [ID_FW]=21, [Validade]=1, in every segment[Prazo], for the last/max date [Data_Cotacao].

 

graph6.JPG

 

I am using this DAX formula:

calculate(average(Spot_FW[Cotacao]),LASTDATE(Spot_FW[Data_Cotacao]),filter(Spot_FW,Spot_FW[ID_FW]=21 && Spot_FW[Validade]=1))
 
The outcome should be in a line graph, the measure in Values, the [Prazo] in axis, as stated below:
graph7.JPG
However there are many segments [Prazo] that for the last date (25-05-2021) have [Validade]=0, though should not be in the graph (image: yellow signal). 
 
Any tip for what am I doing wrong?
 
Thanks in advance.
 
Cheers,
 
1 ACCEPTED SOLUTION
Kumail
Impactful Individual
Impactful Individual

@Anonymous 

 

The file is given below for your reference. 

Kumail_0-1624890929598.png

 

https://drive.google.com/file/d/1iAkJAvLyQU_pvM-39RhX2yukjUbpLQZX/view?usp=sharing

 

I hope this helps or you can send the screenshot from data where the logic fails.

 

Regards

Kumail Raza

View solution in original post

6 REPLIES 6
Kumail
Impactful Individual
Impactful Individual

Hello @Anonymous 

 

You can update the formula to 

Kumail_0-1624882749735.png

 

MAxDateUpdate = 
CALCULATE(AVERAGE(data[Cotacao]), data[ID_FW]=21, data[Validade]=1, LASTDATE(data[Data_Cotacao]))

 

Let me know if this helps. 

 

Regards

Kumail Raza

Anonymous
Not applicable

No @Kumail , unfortunately I still have [Prazo] form another dates.

Kumail
Impactful Individual
Impactful Individual

@Anonymous 

 

Can you send screenshots of the error here.

 

Regards

Kumail Raza

Anonymous
Not applicable

the expression refers to multiple columns. multiple columns cannot be converted to a scalar value

Kumail
Impactful Individual
Impactful Individual

@Anonymous 

 

The file is given below for your reference. 

Kumail_0-1624890929598.png

 

https://drive.google.com/file/d/1iAkJAvLyQU_pvM-39RhX2yukjUbpLQZX/view?usp=sharing

 

I hope this helps or you can send the screenshot from data where the logic fails.

 

Regards

Kumail Raza

Anonymous
Not applicable

Got it @Kumail ! I rewrote the formula and it worked! 

Thank you so much!

 

Best regards!

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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