Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi, I have two tables, one has de prices of my company by iten, the another one has de price of others companies.
For example:
This is my company table
This is others companies's table
This is the result that I want (5th Collumm)
The function that I'm using is:
Preço Empresa = CALCULATE(MEDIAN(TBhistorico_preco_venda[DFpreco]);FILTER(ALL(dCalendario);dCalendario[DATA]<=EARLIER(TBconcorrente_preco[Data])))
But the result are ignoring the date and bring the median of all serie.
So, how can I bring the DFpreço in my company table to my others companies table, taking into account the dates?
Thanks for the Help
Solved! Go to Solution.
This one
Medida =
var datamaxima = calculate(LASTDATE(tabelaprecosempresa[DFdata_alteracao]);filter(all(tabelaprecosempresa[DFdata_alteracao]);tabelaprecosempresa[DFdata_alteracao]<=SELECTEDVALUE(tabelaprecosconcorrente[Data Coleta])))
return
CALCULATE(AVERAGE(tabelaprecosempresa[DFpreco]);filter(ALL(tabelaprecosempresa);tabelaprecosempresa[DFdata_alteracao]=datamaxima && tabelaprecosempresa[DFcod_item_estoque]=SELECTEDVALUE(tabelaprecosconcorrente[DFcod_item_estoque])))
This one
Medida =
var datamaxima = calculate(LASTDATE(tabelaprecosempresa[DFdata_alteracao]);filter(all(tabelaprecosempresa[DFdata_alteracao]);tabelaprecosempresa[DFdata_alteracao]<=SELECTEDVALUE(tabelaprecosconcorrente[Data Coleta])))
return
CALCULATE(AVERAGE(tabelaprecosempresa[DFpreco]);filter(ALL(tabelaprecosempresa);tabelaprecosempresa[DFdata_alteracao]=datamaxima && tabelaprecosempresa[DFcod_item_estoque]=SELECTEDVALUE(tabelaprecosconcorrente[DFcod_item_estoque])))
Hi @RaphaelQueiroz,
Please try this:
Preço Empresa = CALCULATE ( MEDIAN ( TBhistorico_preco_venda[DFpreco] ), FILTER ( ALL ( TBhistorico_preco_venda ), TBhistorico_preco_venda[Dfdata_alteracao] <= EARLIER ( TBconcorrente_preco[DataColeta] ) ) )
Best regards,
Yuliana Gu
Hi,
Does not work. He brings the average of all period, ignoring the date or the cod.
P.s.: When I put MEDIAN in function above, I would like to say AVERAGE.
User | Count |
---|---|
98 | |
75 | |
69 | |
50 | |
27 |