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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
raviteja1994
Regular Visitor

DAX Create measure with multiple aggregations over 2 columns

Hello,

 

I am trying to create a DAX measure with following table.

 

Column AColumn BColumn CDateValue
11P110/26/201710
11P110/27/201720
13P310/28/201710
22P110/29/201715
22P210/30/201725


I want to dislpay the following grid data. 

Column AColumn B Value
1120
1310
2240

 

The measure is calculated as follows:  It is a 2 step aggregation

Get the max value for each of the first 3 column values. i.e after the 1st aggregation the result would look like:

Column AColumn B Column CValue
11P120
13P310
22P115
22P225

 

Now sum it over first 2 columns to get the final result which is:

 

Column AColumn B Value
1120
1310
2240

 

Help me in creating the DAX measure which would result in the above data when I create a table visual in Power BI.  Thanks in advance..

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee

@raviteja1994

You can try

sum =
VAR first_agg_tbl =
    SUMMARIZE (
        yourTable,
        yourTable[Column C],
        "Max of each column C", MAX ( yourTable[Value] )
    )
RETURN
    SUMX ( first_agg_tbl, [Max of each column C] )

Capture.PNG

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee

@raviteja1994

You can try

sum =
VAR first_agg_tbl =
    SUMMARIZE (
        yourTable,
        yourTable[Column C],
        "Max of each column C", MAX ( yourTable[Value] )
    )
RETURN
    SUMX ( first_agg_tbl, [Max of each column C] )

Capture.PNG

Thank you Eric. It was working great..

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.