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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Daily average for latest date with two filters

Hi PBI folks!

I'm trying to figure out a measure to calculate the average price, on the last date available for two specif IDs (ID_SPOT=30 and ID_TIPO_VALOR=8).

The table is:PBI_1.PNG

 

And my output should be the average of column VALOR, for the latest date where the previous IDs were filtered (ID_SPOT=30 and ID_TIPO_VALOR=8).

 

PBI_2.PNG

 

Can you help me out, please?

 

Thanks!

 

Cheers

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , try new measure like

 


measure =
var _max = maxx(filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8), [Data_cotaCAO])
return
AverageX( filter(Table,Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8 && table[Data_cotaCAO] =_max ), [Valor])

 

 

or

 


measure =
var _max = maxx(filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8), [Data_cotaCAO])
return
AverageX( filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8 && table[Data_cotaCAO] =_max ), [Valor])

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @amitchandak ! Thanks for your help, it worked! I gave a go for the first option.

 

Best regards!

amitchandak
Super User
Super User

@Anonymous , try new measure like

 


measure =
var _max = maxx(filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8), [Data_cotaCAO])
return
AverageX( filter(Table,Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8 && table[Data_cotaCAO] =_max ), [Valor])

 

 

or

 


measure =
var _max = maxx(filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8), [Data_cotaCAO])
return
AverageX( filter(allselected(Table),Table[ID_SPOT]=30 && Table[ID_TIPO_VALOR]=8 && table[Data_cotaCAO] =_max ), [Valor])

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.