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

Divide by Sum of 2 columns with Filter

I have a measure that divides sum of 2 columns (from 2 tables). However I need to include a filter in the measure but not sure how to implement this i.e. 'Exception Detail'[Scan Type] <> "No Exception Scan".

Appreciate any help please. Thanks.

%ExcepScan = DIVIDE(SUM('Exception Detail'[COUNT(*)]),SUM('Exception Summary'[NUMBER_OF_PARCELS_NOT_ON_TIME]))

 

4 REPLIES 4
AlB
Community Champion
Community Champion

@Anonymous 

It makes sense that the result changes if you add more filters. You'll have to explain what exact behaviour you want in those cases, and what the expected result is

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

Anonymous
Not applicable

I was expecting the result to be the same for both tables no matter what filters are applied since they both reference the same dataset. Also both tables Exception Scan sum will always be the same, the only difference is that the Details table doesn't have a 'Not on Time' column. Example from the screenshot earlier, both tables showing same number of Exception scans captured = 3, Not on time = 12, so 3/12 = 25%

The only difference here is that the Exception Details table doesn't have a 'Not on Time' column, instead its referencing the Exception Summary table 'Not on Time' column.

AlB
Community Champion
Community Champion

Hi @Anonymous 

How  about

%ExcepScan =
CALCULATE (
    DIVIDE (
        SUM ( 'Exception Detail'[COUNT(*)] ),
        SUM ( 'Exception Summary'[NUMBER_OF_PARCELS_NOT_ON_TIME] )
    ),
    'Exception Detail'[Scan Type] <> "No Exception Scan"
)

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

 

Anonymous
Not applicable

Hi @AlB, thank you that works with date filters only BUT when I apply further filters, the %ExcepScan measure returns 0% as per screenshot below. How to overcome this without explicitly specifying filters in the measure?

Here's link to pbix file fyi

Screenshot 2020-12-21 121259.png

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.