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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
scavalcantes
Regular Visitor

Calculate

I have the image table below, where I need to generate a custom column in the query editor with statistics (average, minimum, maximum, mode.sngl and etc) of the columns Gra1 through Gra5 and Esp1 through Esp5, but the calculation needs to disregard the zeros as we get using the excel formula averageifs.

 

Tabela.jpg

4 REPLIES 4
stretcharm
Memorable Member
Memorable Member

 

You could either unpivot these columns and an calculate based on the attribute (Column) group.

 

http://radacad.com/pivot-and-unpivot-with-power-bi

 

or you could transpost pass the data to r which is very good at working with data sets like this and applying stats.

 

https://docs.microsoft.com/en-us/power-bi/desktop-r-in-query-editor

 

 

The first option was to use the pivot, but the performace on a machine (i5, 6GB raw, 64bit and 1TB of hd, was compromised and when using dax union function to update only table 2018, simply the machine hangs.
Regarding the R still studying the possibility, but needs to be faster.
Would you have another solution?

You can also write multiple dax measures that calculate the stats for each of the base columns

 

https://www.daxpatterns.com/statistical-patterns/

 

I like to create a dax summary table than can be joined to your other data using ADDCOLUMNS and SUMMARIZE

 

https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/

 

 BTW r is very fast, though does need the data to be in memory.

O problema da performace foi devido a converter colunas em linha por grupo de colunas, com isso, o desempenho ficava compromentido.

A solução foi selecionar todas as colunas que tem valores a calcular e assim fazer o pivot

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.