I have a scenario where I am trying to calculate the average price of an item within given dates based on a slicer date. The issue I have is that when I put the date on a table I want the average price to be calculated based on the max and min of the slicer selections. So the filter context when the dates are on a table need to be somehow suspended and only consider the dates based on the slicer. This is what I have tried below but it is not giving me the correct answer I want when I put in in a table.
OrgT Avg P =
VAR OrgTMinPrice = MIN(‘1inchPolygonOrigin’[Origin Token])
VAR AveragePrice = AVERAGEX(
VALUES(Dates[Date]),
OrgTMinPrice)
VAR Mindates = CALCULATE(MIN(Dates[Date]),ALLSELECTED())
VAR Maxdates = CALCULATE(MAX(Dates[Date]),ALLSELECTED())
VAR Result = CALCULATE(AveragePrice,DATESBETWEEN(Dates[Date],Mindates,Maxdates))
I want to calculate the average price but I want it to only respond to the slicer dates and not the date in the column. Does that make it a bit clearer? I don’t know if we will need a disconnected table here.
If I understand correctly then you are asking to show data for only Min date and Max date from the date slicer, if you can share your pbix file then it will be easier for forum expert to help you. I am adding below video which might help in using disconnected table and using the TRETAS for the filter in disconnected table.
Hi @ambepat. Your screenshot has not illustrated the desired outcome to me clearly, so perhaps a mock-up of your desired outcome in Excel using the same data as is in your work-in-progress PBIX would help the forum members with their analyses.
Greg
Yes that value appears in the subtotal but I want it to appear where the dates are. So from the 23.04 onwards down should show 5.52 under the Average Price inch. So
Date Inch Average Price
23-04-2021 4.29 5.52
24-04-2021 4.06 5.52
all the way downwards
Hi @ambepat, did the response provided by the users and experts help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query. Thanks!
Hi @ambepat, we’ve noticed that no response has been received from you since the 2nd of June. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.