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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MVCPA
Frequent Visitor

Remove columns with zero sum values in a matrix (P&L)

Hi everyone,

 

I am having hard time trying to remove columns in my matrix table for my P & L.

 

MVCPA_1-1698107403082.png

 

As you can see in this image, Sites A, B, D and G are all zero's resulting from a Sum of figures and I want to remove them.

 

Here's my Measure:


Actual = Var Calctype = SELECTEDVALUE('Header Assignment'[CalcType])
            Var Displaydetailcode = SELECTEDVALUE('Header Assignment'[Detail])
            Var IsSubheaderVisible = ISFILTERED('Accounts Name2'[Account Name])
            Var IsBracketVisible = ISFILTERED(Bracket[Bracket])
            Var IsPeriodVisible = ISFILTERED('Date Table'[Year Month])
            Var Result = SWITCH(TRUE(),
                isSubheaderVisible=True() && DisplayDetailCode = 0  ,BLANK(),
                isSubheaderVisible=True() && IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                    Calctype = 1, [SUM AMOUNT],
                    Calctype = 2, [Running Total A],
                    Calctype = 3, DIVIDE([Running Total A],[Rev amount 2],0)
       
               
               
                )
            Return Result

I would really appreciate if someone can help me figure this out. I tried using the proposed solutions from this article but I am unsucessful still. 
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@MVCPA 

Not sure if this will work but give it a try.  You are using 
RETURN Result

There is a trick with DIVIDE where, when you divide by 0 it returns a null instead of a 0 so you can use

Return DIVIDE(Result,Result) * Result

null * 0 is null

The whole measure would look like this.

Actual = Var Calctype = SELECTEDVALUE('Header Assignment'[CalcType])
            Var Displaydetailcode = SELECTEDVALUE('Header Assignment'[Detail])
            Var IsSubheaderVisible = ISFILTERED('Accounts Name2'[Account Name])
            Var IsBracketVisible = ISFILTERED(Bracket[Bracket])
            Var IsPeriodVisible = ISFILTERED('Date Table'[Year Month])
            Var Result = SWITCH(TRUE(),
                isSubheaderVisible=True() && DisplayDetailCode = 0  ,BLANK(),
                isSubheaderVisible=True() && IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                    Calctype = 1, [SUM AMOUNT],
                    Calctype = 2, [Running Total A],
                    Calctype = 3, DIVIDE([Running Total A],[Rev amount 2],0)
                )
            Return DIVIDE(Result,Result) * Result

View solution in original post

5 REPLIES 5
jdbuchanan71
Super User
Super User

OK, but did the trick with the measure work?

Return DIVIDE(Result,Result) * Result

I would like to attach a sample pbix for future referrence but it is not letting me saying it is not supported. 😞

Yes it did and it worked like magic! Thank you! I really appreciate your help!

jdbuchanan71
Super User
Super User

@MVCPA 

Not sure if this will work but give it a try.  You are using 
RETURN Result

There is a trick with DIVIDE where, when you divide by 0 it returns a null instead of a 0 so you can use

Return DIVIDE(Result,Result) * Result

null * 0 is null

The whole measure would look like this.

Actual = Var Calctype = SELECTEDVALUE('Header Assignment'[CalcType])
            Var Displaydetailcode = SELECTEDVALUE('Header Assignment'[Detail])
            Var IsSubheaderVisible = ISFILTERED('Accounts Name2'[Account Name])
            Var IsBracketVisible = ISFILTERED(Bracket[Bracket])
            Var IsPeriodVisible = ISFILTERED('Date Table'[Year Month])
            Var Result = SWITCH(TRUE(),
                isSubheaderVisible=True() && DisplayDetailCode = 0  ,BLANK(),
                isSubheaderVisible=True() && IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                IsBracketVisible =TRUE() && DisplayDetailCode = 0  ,BLANK(),
                    Calctype = 1, [SUM AMOUNT],
                    Calctype = 2, [Running Total A],
                    Calctype = 3, DIVIDE([Running Total A],[Rev amount 2],0)
                )
            Return DIVIDE(Result,Result) * Result

Thank you for your reply. I am actually getting the problem from this line and not from the other lines: 

 Calctype = 1, [SUM AMOUNT],

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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