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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SriBhaskar
Regular Visitor

DAX sum and max based on the hierarchy in matrix visual in Power BI

Below is my data set 'SOWSMTData' that I am imported in power bi. 

SOW NameSMTNameTotalSOWValueJanActualFebActual
XXXVijay50108
XXXVijay50119
YYYVijay7009
YYYVijay7087
YYYVijay701015
ZZZSiva3054
ZZZSiva3064
BBBSiva40105
AAASai80104
CCCSai9076
CCCSai90810
XXXSai5030
YYYMohan7025
YYYMohan7058

 

In the above I have SOWName, SMTName and SOWValue. One SOW mapped to different SMTNames. When I take the SOWName I need to get the same value in the matrix. I need the below output in Matrix Visual in Power BI. Under SMTName the SOW is drilldown like below.

SMTNameMTotalSOWValueJanActualFebActual
Vijay1203948
  XXX502117
  YYY701831
Siva702113
  ZZZ30118
  BBB40105
Sai2202820
  AAA80104
  CCC901516
  XXX5030
Mohan70713
  YYY70713

 

I am facing issue while calculating the 'TotalSOWValue' measure in the above matrix.

I tried the below two measures 

MTotalSOWValue = CALCULATE(MAX(SOWSMTData[TotalSOWValue]),ALL(SOWSMTData[SOWName)) 

MTotalSOWValue =

SUMX(
    ADDCOLUMNS(
        SUMMARIZE(
            SOWSMTData,
            SOWSMTData[SMTName],

            SOWSMTData[SOWName],
        ),
        "MaxSOWValue",
            CALCULATE(
                MAX( SOWSMTData[SOWName] )
            )
    ),
    [MaxSOWValue]
)

 

I am not getting the subtotals correct by using above two measures. Please guide me if there is anything I missed. 

I think becuase the same SOWName relates to different SMTName. Please suggest.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @SriBhaskar ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
MAXX(
    FILTER(ALL('Table'),
    'Table'[SOW Name]=MAX('Table'[SOW Name])&&'Table'[SMTName]=MAX('Table'[SMTName])),[TotalSOWValue])
True =
var _table1=
SUMMARIZE('Table','Table'[SMTName],'Table'[SOW Name],"Value1",[Measure])
return
IF(
    HASONEVALUE('Table'[SOW Name]),[Measure],
SUMX(_table1,[Value1]))

2. Result:

vyangliumsft_0-1694421733921.png

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Hi  @SriBhaskar ,

 

Here are the steps you can follow:

1. Create measure.

Measure =
MAXX(
    FILTER(ALL('Table'),
    'Table'[SOW Name]=MAX('Table'[SOW Name])&&'Table'[SMTName]=MAX('Table'[SMTName])),[TotalSOWValue])
True =
var _table1=
SUMMARIZE('Table','Table'[SMTName],'Table'[SOW Name],"Value1",[Measure])
return
IF(
    HASONEVALUE('Table'[SOW Name]),[Measure],
SUMX(_table1,[Value1]))

2. Result:

vyangliumsft_0-1694421733921.png

 

Best Regards,

Liu Yang

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

nirali_arora
Resolver II
Resolver II

It seems like you require the following formula : 

Maxx(Values(Table[SOW]), calculate(Sum(SOWSMTData[TotalSOWValue])))

The similar concept is explained in this video : https://youtu.be/cN8AO3_vmlY?t=22980

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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