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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ElodiePignato
Regular Visitor

DAX formula - Average

Hello everyone !

 

I have an issue with a DAX formula.

 

I have a table named "Incomind documents". It's one row per ticket (workload), a column with the status (done, on hold, to treat, etc.) and a column with the reception date.

 

I would like to calculate the average of incoming tickets for the last 12 months.

 

Any idea how to do that ?

 

Thanks !

7 REPLIES 7
Dangar332
Super User
Super User

hi, @ElodiePignato 

 

 

result =
 averagex(
     filter('Incomind documents',
        dateadd('Incomind documents'[reception date],-1,year)
            ),
     'Incomind documents[workload]
          )

 

Thank you @Dangar332 but I have this error message :

 

"The function AVERAGEX cannot work with values of type String.

hi, @ElodiePignato 

 

i think your   'incomind documents'[workload]  is string type. so it could happen

can you provide some sample data?

I finally used this measure:

 

Capture d’écran 2023-10-31 081144.jpg

 

But it's showing me the exact same result than another formula where I calculate the incoming tickets from last month using "COUNTROWS" :

Capture d’écran 2023-10-31 080945.jpgCapture d’écran 2023-10-31 081017.jpg

HI, @ElodiePignato 

as i understand you want to avg of last 12 month with beginning of month of today
if yes then follow below

 

result =
var a = eomonth(today(),-13)+1   //  this give you  (11/1/2022)  as you want beginning of month of today with 12 month difference


var b = calculate(
          countrows(yourtablename),
          'Incomind documents'[reception date]>=a &&
          'Incomind documents'[reception date]<=today()
                  )  // give rows b/w  (11/1/2022 to 11/2/2022)

return 
divide(b,12)

)

Hi @Dangar332 this formula gives a whole different result :

 

ElodiePignato_0-1698928512552.png

 

The previous DAX formula was "better".

 

I checked with the table "Incoming documents" via Excel and this is the numer of incoming tickets per month :

ElodiePignato_1-1698929418060.png

 

So the average should be around 5k

hi, @ElodiePignato 

 

try to update previous formula

result =
var a = eomonth(today(),-13)+1  
 return
averagex(
     filter('Incomind documents',
        'Incomind documents'[reception date]>=a &&  
        'Incomind documents'[reception date]<=today()
            ),
     'Incomind documents[workload]
          )

 

if not work then provide some sample data


 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.