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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
mr_wizard
Resolver I
Resolver I

how to summarize a measure over many dimension tables

I have a data model with 2 fact tables (say, FactA and FactB) and 2 dimension tables (say DimX and DimY), along with a measure that is a function of both fact tables (say [Variance]).  I need to summarize that measure over fields 'DimX'[Field1] and 'DimY'[Field2], and then I need to compute the sum of the summarized measure.  How can I do so?

 

I tried the following, but it doesn't give me the result that I expect.

 

Variance Summarized by Field 1 and Field 2 =

 

VAR __table =
    ADDCOLUMNS(
        CROSSJOIN(
            DISTINCT('DimX'[Field1]
            ,DISTINCT('DimY'[Field2]       

    )
    ,"Variance Summarized by Field 1 and Field 2"
    ,[Variance]
)

 

VAR __total =
    SUMX(
        __table

        ,[Variance Summarized by Field 1 and Field 2]

)

RETURN

    __total

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @mr_wizard ,

 

Please try this:

Measure = 
SUMX (
    SUMMARIZE (
        CROSSJOIN ( VALUES ( 'DimX'[Field1] ), VALUES ( 'DimY'[Field2] ) ),
        "Variance Summarized by Field 1 and Field 2", [Variance]
    ),
    [Variance Summarized by Field 1 and Field 2]
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @mr_wizard ,

 

Please try this:

Measure = 
SUMX (
    SUMMARIZE (
        CROSSJOIN ( VALUES ( 'DimX'[Field1] ), VALUES ( 'DimY'[Field2] ) ),
        "Variance Summarized by Field 1 and Field 2", [Variance]
    ),
    [Variance Summarized by Field 1 and Field 2]
)

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

mr_wizard
Resolver I
Resolver I

@danextianThat doesn't work.  SUMMARIZECOLUMNS cannot be used in a context transition, i.e., it can't be used in a measure.  I think SUMMARIZE is necessary.  But, SUMMARIZE only works over one table (which is why I thought that CROSSJOIN was necessary).

danextian
Super User
Super User

Hi @mr_wizard 

 

Try using SUMMARIZECOLUMNS

 

SUMX (
    SUMMARIZECOLUMNS (
        'DimX'[Field1],
        'DimY'[Field2],
        "Variance Summarized by Field 1 and Field 2", [Variance]
    ),
    [Variance Summarized by Field 1 and Field 2]
)

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors