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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Chandrashekar
Resolver III
Resolver III

Help with Measures

Hello Team,

 

In attached file Sample Report I have two measures. is it possible to combine Measure 2 with Measure 1.

Chandrashekar_0-1643009026456.png

Regards,

Chandrashekar B

 

1 ACCEPTED SOLUTION

Try putting your variables inside the SUMX.

_countrows = 
SUMX (
    SUMMARIZE ( Table3, Table3[Name], Table3[Location] ),
    VAR _tbl =
        CROSSJOIN (
            SELECTCOLUMNS ( { Table3[Name] }, "name", [Value] ),
            SELECTCOLUMNS ( { Table3[Location] }, "location", [Value] )
        )
    RETURN
        CALCULATE (
            COUNTROWS ( FILTER ( Table1, Table1[Priority] = 1 ) ),
            TREATAS ( _tbl, Table1[Name], Table1[Location] )
        )
)

 

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

How about this?

Combined = 
SUMX (
    SUMMARIZE ( Table3, Table3[Name], Table3[Location] ),
    CALCULATE (
        COUNTROWS ( FILTER ( Table1, Table1[Priority] = 1 ) ),
        Table1[Name] = EARLIER ( Table3[Name] ),
        Table1[Location] = EARLIER ( Table3[Location] )
    )
)

Hello Alex,

 

It is working fine but not working if i use Treatas. Any advise on it.

_countrows =
VAR _name =
MAX ( Table3[Name] )
VAR _location =
MAX ( Table3[Location] )
VAR _tbl =
CROSSJOIN (
SELECTCOLUMNS ( { _name }, "name", [Value] ),
SELECTCOLUMNS ( { _location }, "location", [Value] )
)
RETURN
SUMX(
SUMMARIZE(Table3,Table3[Name],Table3[Location]),
CALCULATE (
COUNTROWS ( FILTER ( Table1, Table1[Priority] = 1 ) ),
TREATAS ( _tbl, Table1[Name], Table1[Location] )

))

 

Regards,

Chandrashekar B

Try putting your variables inside the SUMX.

_countrows = 
SUMX (
    SUMMARIZE ( Table3, Table3[Name], Table3[Location] ),
    VAR _tbl =
        CROSSJOIN (
            SELECTCOLUMNS ( { Table3[Name] }, "name", [Value] ),
            SELECTCOLUMNS ( { Table3[Location] }, "location", [Value] )
        )
    RETURN
        CALCULATE (
            COUNTROWS ( FILTER ( Table1, Table1[Priority] = 1 ) ),
            TREATAS ( _tbl, Table1[Name], Table1[Location] )
        )
)

 

Hello Alex,

 

Thanks it is working fine.

Regards,

Chandrashekar B

Hello Alex,

 

Thank you and will try on it.

 

Regards,

Chandrashekar B

amitchandak
Super User
Super User

@Chandrashekar , I tried a few combinations. Current two measure solution seems better

 

 I tried this and it did not work

 

_countrows = 
VAR _name =
    MAX ( Table3[Name] )
VAR _location =
    MAX ( Table3[Location] )
VAR _tbl =
    CROSSJOIN (
        SELECTCOLUMNS ( { _name }, "name", [Value] ),
        SELECTCOLUMNS ( { _location }, "location", [Value] )
    )
var _final = CALCULATE (
        COUNTROWS ( FILTER ( Table1, Table1[Priority] = 1 ) ),
        TREATAS ( _tbl, Table1[Name], Table1[Location] )
    )
RETURN sumx(ADDCOLUMNS(summarize(Table3,Table3[Name],Table3[Location]),"_1",calculate(_final)),[_1])
     

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.