Search code examples
powerbidaxmeasure

Different Periods Average in Power BI


Here is my data

Finance

enter image description here

I have chart that display monthly data

Like this

enter image description here

I need to do average for periods that are specified in another table.

Periods

enter image description here

So the end results should look like this

enter image description here

I know it should be a New Measure, but not sure how to write the DAX for that measure to do this averaging

I tried and ended with this, but it is not working

CALCULATE (
Average(Finance[Result]),
FILTER (
ALL ( Periods),
DATE ( Finance[Year], Finance[Month], 1 ) >= Periods[FromDate] 
&&  DATE ( Finance[Year], Finance[Month], 1 ) < Periods[ToDate]
)
)

but this is does not work

Anyone know how to build the measure dax to do this?


Solution

  • in your place i would add a column in finance table which contains the period values too...