cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper II

## Create new measure to get Average

Hi, I have a table which contains Date, CustomerName, Price, month, & weekday.

I have created measure using the DAX, Day 1 = CALCULATE(sum(Actual[Price]),FILTER('Actual','Actual'[Day]=1))

similarly for all days. If i select 3 months at a time i am getting the total values, as shown in the fig

My query is  I need to get an average value's if i select 2 or 3 months in the slicer.  Anyone has an idea how to solve this ?

1 ACCEPTED SOLUTION
Microsoft Employee

Hi @siva3012,

Create an extra measure like:

`Count month selected = DISTINCTCOUNT(Actual[Month])`

Modify the measure for Day 1 as below:

`Day 1 = CALCULATE(sum(Actual[Price]),FILTER('Actual','Actual'[Day]=1))/[Count month selected]`

Result.

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 REPLIES 5
Microsoft Employee

Hi @siva3012,

Create an extra measure like:

`Count month selected = DISTINCTCOUNT(Actual[Month])`

Modify the measure for Day 1 as below:

`Day 1 = CALCULATE(sum(Actual[Price]),FILTER('Actual','Actual'[Day]=1))/[Count month selected]`

Result.

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Helper II

@v-yulgu-msft : Is it possible to draw an average line for those data which is shown in the graph ? Like this

Helper II

@v-yulgu-msft : Hi, There is an small eror in the solution. If we select 2 Months data Jan & Feb in slicer. Jan has 31 days and Feb has 28 days. The average is been calaculated wrongly for Jan 29, 30 & 31.

Do you have any idea over this ?

Helper II

I have solved this issue,

Day 1 = CALCULATE(sum(Actual[Price]),FILTER('Actual','Actual'[Day]=1))/(CALCULATE([Count month selected],Actual[Day]=1))

Helper II

@v-yulgu-msft : Thank you for the solution.

Announcements

#### 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.