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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

how to call another column within ISINSCOPE?

I have 3 levels on a matrix. (level 3 being the lowest...)

 

I want to do a measure like:

 

 

Cost:=



VAR Sumat = [FixedCosts]+[VariableCosts]



Return



SWITCH (

    TRUE (),

    ISINSCOPE ( Project[proj] ), IF (Sumat <0, 0, [Sumat]), --Level2

    ISINSCOPE ( Project[Comp] ), sum(Level2], -- the aggregation at this level want to be it the sum of level 2

    Sumat  --Level 3

)

 

 

That is,  (from lowest to uppest level...

  • level 3 is FixedCosts+VariableCosts
  • level2 is FixedCosts+VariableCosts (but if it is negative I want to display 0).
  • level1 is the sum of level2
1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try this method:

Here is my test sample data:

vyinliwmsft_0-1669191391279.png

Then create the measure of fcost and vcost:

FixedCosts = SUM('Table'[FCosts])
VariableCosts = SUM('Table'[VCosts]) 

Then create 2 measures:

Basic =
VAR _sumat = [FixedCosts] + [VariableCosts]
VAR _sumlevel2 =
    IF ( _sumat < 0, 0, _sumat )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Level3] ),
        _sumat,
        IF ( ISINSCOPE ( 'Table'[Comp] ), _sumlevel2 )
    )
Result =
VAR _LEVEL1 =
    SUMX (
        SUMMARIZE (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Proj] = MAX ( 'Table'[Proj] )
                    && 'Table'[Comp] IN VALUES ( 'Table'[Comp] )
            ),
            'Table'[Proj],
            'Table'[Comp]
        ),
        [Basic]
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Proj] ), _LEVEL1, [Basic] )

The result is:

vyinliwmsft_1-1669191546373.png

Hope this helps you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

3 REPLIES 3
v-yinliw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You can try this method:

Here is my test sample data:

vyinliwmsft_0-1669191391279.png

Then create the measure of fcost and vcost:

FixedCosts = SUM('Table'[FCosts])
VariableCosts = SUM('Table'[VCosts]) 

Then create 2 measures:

Basic =
VAR _sumat = [FixedCosts] + [VariableCosts]
VAR _sumlevel2 =
    IF ( _sumat < 0, 0, _sumat )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Level3] ),
        _sumat,
        IF ( ISINSCOPE ( 'Table'[Comp] ), _sumlevel2 )
    )
Result =
VAR _LEVEL1 =
    SUMX (
        SUMMARIZE (
            FILTER (
                ALL ( 'Table' ),
                'Table'[Proj] = MAX ( 'Table'[Proj] )
                    && 'Table'[Comp] IN VALUES ( 'Table'[Comp] )
            ),
            'Table'[Proj],
            'Table'[Comp]
        ),
        [Basic]
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Proj] ), _LEVEL1, [Basic] )

The result is:

vyinliwmsft_1-1669191546373.png

Hope this helps you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

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

Anonymous
Not applicable

Thank you @v-yinliw-msft 

 

Works like a charm!!, thanks... I was trying to add a higher level4 (from Client table) but it doesn't work...

 

How can I add a higher level from another table?

 

I try to recreate your steps, but here I do :

 

ALL ( 'Client' ),

  and then of course the syntax is not valid because I am using data from 'Table' too...

amitchandak
Super User
Super User

@Anonymous , Try for level 1

 

Suxm(Values( Project[Comp] ), if(Sumat <0 , 0, Sumat ))

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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