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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MichiyoTora
Frequent Visitor

Average of averages of averages DAX measure into a matrix visual

Hi everyone !

I have datas seems like this :

 
platformdomainproductcomponentvalue
PDPLEGACY MODERNIZATION PROGRAMCARBONintercompany-sales-pegase29.016666666666666
PDPLEGACY MODERNIZATION PROGRAMCARBONpegase-api-logistique0.0048611111111111112
PDPLEGACY MODERNIZATION PROGRAMCARBONpegase-api-logistique-v220.244444444444444
PDPLEGACY MODERNIZATION PROGRAMCARBONperseus-costing-in-pegase0.026388888888888889
PDPLEGACY MODERNIZATION PROGRAMCARBONintercompany-price-pegase20.245833333333334
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-spp-basa67.2076388888889
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-pcmd-basa60.880555555555553
PDPLEGACY MODERNIZATION PROGRAMBASAapi-spp-basa54.071527777777774
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-api-spp-basa8.2854166666666664
PDPLEGACY MODERNIZATION PROGRAMBASAapi-mn-basa7.3041666666666663
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-pspsa-basa39.205555555555556
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-pmn-int-basa67.171527777777783
PDPLEGACY MODERNIZATION PROGRAMBASAapi-sps-basa54.689583333333331
PDPLEGACY MODERNIZATION PROGRAMBASAconverter-mn-int-basa59.181944444444447
PDPOFFER BUILDING & OPTIMIZATIONPROAproa-front21.486805555555556
PDPOFFER BUILDING & OPTIMIZATIONPROAproa-optimizer41.729861111111113
CCDPSERVICESAGENDE CONDIVISEwebappointment-backend-customer0.92638888888888893
CCDPSERVICESAGENDE CONDIVISEsharedagenda-backend19.728472222222223
CCDPSERVICESAGENDE CONDIVISEwebappointment-frontend-customer4.7763888888888886
CCDPSERVICESAGENDE CONDIVISElegacy-adapter-for-webappointment36.8625

 

We have to calculate the averages of the column "value", however we have to follow the rule : "all component have the same weight in a product, all product have the same weight in a domain, and all domain have the same weight in a platform. The goal is to have some table like this : 

 

MichiyoTora_3-1693557651374.png

 

So, I have to do average of the averages of products to have the Domain view. I tried a lot of things in dax but nothing work since product level ... (for example on the last screenshot, the value for the domain "LEGACY MODERNIZATION PROGRAM" should be CARBON + BASA / 2, i.e. 8.12, not 7.19)

 

I tried averagex with temp table but I don't know why this doesn't work.

measure = VAR comp = SUMMARIZE('table','table'[Platform],'table'[Domain],'table'[product_id],'K8S deployments'[component_name],"K1",CALCULATE(AVERAGEX('table',[Value])))
VAR prod = SUMMARIZE(comp,[Platform],[Domain],[product_id],"K1P",AVERAGEX(comp,[K1]))
VAR dom = SUMMARIZE(prod,[Platform],[Domain],"K1D",AVERAGEX(prod,[K1P]))
VAR plat = SUMMARIZE(dom,[Platform],"K1P",AVERAGEX(dom,[K1D]))
return AVERAGEX(plat,[K1P])

Can you help me please ?

2 ACCEPTED SOLUTIONS
v-yueyunzh-msft
Community Support
Community Support

Hi , @MichiyoTora 

According to your description, you want to calculate the average for the same weight . This is my understand for your need :

vyueyunzhmsft_0-1693807787723.png

If this , here are the steps you can refer to :
(1)This is my test data :

vyueyunzhmsft_1-1693807819213.png

(2)We can create three measures like this:

Domain value = 
var _t = SUMMARIZE('Table' , 'Table'[domain],'Table'[product] ,"avg" , [Average Measure])
return
averagex(_t,[avg])
Platform Value = 
var _t = SUMMARIZE('Table' , 'Table'[platform],'Table'[domain] ,"avg" ,[Domain value])
return
averagex(_t,[avg])
Measure = IF( ISINSCOPE('Table'[component]) , [Average Measure] , IF( ISINSCOPE('Table'[product]) , [Average Measure] , IF(ISINSCOPE('Table'[domain] ) , [Domain value] ,
IF( ISINSCOPE('Table'[platform]) , [Platform Value]))))

 

(3)Then we can put the measures on the visual and we can get the result as follows and the [Measure] is the end result we need:

vyueyunzhmsft_2-1693807898338.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

View solution in original post

Hi , @MichiyoTora 

Sure , you can try to use this dax code :

Measure 2 = SUMX(VALUES('Table'[platform]) , [Measure])

 

The result is as follows:

vyueyunzhmsft_0-1693904523935.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

4 REPLIES 4
v-yueyunzh-msft
Community Support
Community Support

Hi , @MichiyoTora 

According to your description, you want to calculate the average for the same weight . This is my understand for your need :

vyueyunzhmsft_0-1693807787723.png

If this , here are the steps you can refer to :
(1)This is my test data :

vyueyunzhmsft_1-1693807819213.png

(2)We can create three measures like this:

Domain value = 
var _t = SUMMARIZE('Table' , 'Table'[domain],'Table'[product] ,"avg" , [Average Measure])
return
averagex(_t,[avg])
Platform Value = 
var _t = SUMMARIZE('Table' , 'Table'[platform],'Table'[domain] ,"avg" ,[Domain value])
return
averagex(_t,[avg])
Measure = IF( ISINSCOPE('Table'[component]) , [Average Measure] , IF( ISINSCOPE('Table'[product]) , [Average Measure] , IF(ISINSCOPE('Table'[domain] ) , [Domain value] ,
IF( ISINSCOPE('Table'[platform]) , [Platform Value]))))

 

(3)Then we can put the measures on the visual and we can get the result as follows and the [Measure] is the end result we need:

vyueyunzhmsft_2-1693807898338.png

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

 

Hi !
Thank's a lot, it works perfectly !!!
I doesn't know ISINSCOPE function, it's magic !

Last question, do you think we can have the grand total in the matrix visual ? 
Thx again !

Hi , @MichiyoTora 

Sure , you can try to use this dax code :

Measure 2 = SUMX(VALUES('Table'[platform]) , [Measure])

 

The result is as follows:

vyueyunzhmsft_0-1693904523935.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

You're awesome !
Thx again !

Best regards.

Helpful resources

Announcements
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.