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
karnag
Regular Visitor

Aggregate of Max value in a matrix heirarchy

How to get Aggregate of (SUM) of Max Value, which is calculated 

 

Lets say we have A--B in the heirarchy, The following formula is getting correct results calculated at level B, For for Level A, We are getting Max of the values as shown in the snapshot below.  How to get aggregate of the measure formula shown below at level A ?

 

Max of Capacity Hours =
SUMX(
    (VALUES('Enhanced Utilization'[Exp YearMonth])),
    CALCULATE(MAX('Enhanced Utilization'[Capacity Hours]))
)
 
karnag_0-1655155840566.png

 

Appreciate your help

1 ACCEPTED SOLUTION

Hi @karnag ,

I updated your sample pbix file(see attachment), please check if that is what you want. Please update the formula of measure [Max of Capacity Hours average per Exp YearMonth] as below:

Max of Capacity Hours average per Exp YearMonth =
MAXX (
( VALUES ( 'Enhanced Utilization'[Exp YearMonth] ) ),
CALCULATE ( MAX ( 'Enhanced Utilization'[Capacity Hours] ) )
)

yingyinr_0-1655865087397.png

Best Regards

Community Support Team _ Rena
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

9 REPLIES 9
karnag
Regular Visitor

Please note the granularity of Capacity Hours is higher Vs the Util Table which is at a much lower level.

karnag
Regular Visitor

Hi @v-yiruan-msft 

Here is a snapshot, 

 

Snapshot Util.jpg

Please find the .pbix file at the following location. (Simplified Model)

https://drive.google.com/drive/folders/1uByte3umAH_BW-Ubkm_z-djVlI_ZyV8t?usp=sharing

 

Hi @karnag ,

I updated your sample pbix file(see attachment), please check if that is what you want. Please update the formula of measure [Max of Capacity Hours average per Exp YearMonth] as below:

Max of Capacity Hours average per Exp YearMonth =
MAXX (
( VALUES ( 'Enhanced Utilization'[Exp YearMonth] ) ),
CALCULATE ( MAX ( 'Enhanced Utilization'[Capacity Hours] ) )
)

yingyinr_0-1655865087397.png

Best Regards

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

Tried the inscope option, But didn't help

karnag
Regular Visitor

Thanks @v-yiruan-msft

Will try the solution provided and will get back to you. Appreciate your help

v-yiruan-msft
Community Support
Community Support

Hi @karnag ,

I created a sample pbix file(see attachment) for you, please check whether that is what you want. You can create two measures as below:

 

Sum of capactity hours = SUM('Enhanced Utilization'[Capacity Hours])
Measure = 
IF (
    ISINSCOPE ( 'Enhanced Utilization'[Exp YearMonth] ),
    MAXX ( 'Enhanced Utilization', [Sum of capactity hours] ),
    [Sum of capactity hours]
)

 

yingyinr_0-1655358029799.png

In addition, you can refer the following links.

Hierarchies

Use IsInScope to get the right hierarchy level in DAX

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Hi,

I am looking for something like the one shown below. 

karnag_0-1655901615767.png

 

 

Hi @karnag ,

I updated your sample pbix file(see attachment) again, please check if that is what you want.

1. Update the formula of measure [Max of Capacity Hours average per Exp YearMonth] as below

Max of Capacity Hours average per Exp YearMonth = 
VAR _tab =
    SUMMARIZE (
        'Enhanced Utilization',
        'Enhanced Utilization'[Exp YearMonth],
        "@maxcapacityhour", MAX ( 'Enhanced Utilization'[Capacity Hours] )
    )
RETURN
    SUMX ( _tab, [@maxcapacityhour] )

2. Create another new measure as below to replace the measure [Max of Capacity Hours average per Exp YearMonthon the matrix

Measure = 
SUMX (
    VALUES ( 'Enhanced Utilization'[CONSULTANT_NAME] ),
    [Max of Capacity Hours average per Exp YearMonth]
)

yingyinr_0-1655954574127.png

Best Regards

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

Thanks @yingyinr

It worked except for the Total row at the bottom.

Appreciate your help. 

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.