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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calculating last year average to add in a pivot table

Hi All, 

 

I would appreciate your help on a measure that I have spent several days trying to add to a pivot table. 

 

I would like to calculate last year (2018) average nb of leads, using the data format below. I have tried to use several DAX formulas but nothing worked.

image.png

My aim is to recreate the following pivot table: 

image.png

Many thanks in advance. 

 

Veronica

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for taking the time to get back to me. Unfortuantely, the formula returns an incorrect average.

 

I have checked and no filters were applied. The above formula seems to return a monthly average for 2018.

 

I found that the following DAX formual works:

 

2018 AVG Leads= CALCULATE (

                                  SUM ( Table[Leads(nb) by Channel]),

                                  FILTER(Table, AND (Table[Date],(Table[Year]=2018))))/12

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

You may create a measure using DAX like pattern below:

 

Result =
CALCULATE (
    AVERAGE ( Table[Leads(nb) by Channel] ),
    FILTER ( Table, YEAR ( Table[Date] ) = YEAR ( TODAY () ) - 1 )
)

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you for taking the time to get back to me. Unfortuantely, the formula returns an incorrect average.

 

I have checked and no filters were applied. The above formula seems to return a monthly average for 2018.

 

I found that the following DAX formual works:

 

2018 AVG Leads= CALCULATE (

                                  SUM ( Table[Leads(nb) by Channel]),

                                  FILTER(Table, AND (Table[Date],(Table[Year]=2018))))/12

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.