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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
rufmau68
Helper II
Helper II

average of sum

Hi, im new in power bi and i fighting with DAX language

 

hi have calculated a measure with this

A = iferror(sum(SCHEDA_CNT_AZIENDA_ENTE[A_PERCORRENZA_EFFETTIVA])/sum(SCHEDA_CNT_AZIENDA_ENTE[A_VEICOLI_UTILIZZATI]), blank())
 
if i list it, by DENOM_ENTE Category , follows the  result: BUT I NEED TO CALCULATE avg(A) , and i dont know hot to calculate it
 
rufmau68_0-1618234054906.png

 

 
4 REPLIES 4
v-jayw-msft
Community Support
Community Support

Hi @rufmau68 ,

 

You want to calculate the average of [A] which is [A]/count of category?

If so you could try the following measure.

[A]/calculate(distinctcount(category),all(table))

If not, please show some sample data and expected result to us.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@rufmau68 , A seem to Avg Already X/Y

Try Like

Divide(sum(SCHEDA_CNT_AZIENDA_ENTE[A_PERCORRENZA_EFFETTIVA]),sum(SCHEDA_CNT_AZIENDA_ENTE[A_VEICOLI_UTILIZZATI]))

 

Usually, If we want sum till category and avg after that of a measure A, then we will do 

 

Averagex(Value(Table[Category]), [Measure])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

dont works neither if i wont to match every sum() by denom_ente with grand total

with womthinks like this

grandTotal = calculate(sum(SCHEDA_CNT_AZIENDA_ENTE[A_PERCORRENZA_EFFETTIVA]),all(Calendario[Anno]))
 

rufmau68_0-1618240566230.png

 

i try it but dont works: it return the same value in A column, it seems that it dont overrides category table contest... (*)

rufmau68_0-1618236254492.png

(*) i use values() and not value(), because value() need measure column name and not category column name

avgA= Averagex(Values(SCHEDA_CNT_AZIENDA_ENTE[ANNO]), divide(sum(SCHEDA_CNT_AZIENDA_ENTE[A_PERCORRENZA_EFFETTIVA]),sum(SCHEDA_CNT_AZIENDA_ENTE[A_VEICOLI_UTILIZZATI])))
 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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